Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman - invalid cURL command / missing argument

Tags:

http

curl

postman

I am trying to import a cURL command into Postman, but it says I have a missing argument, but the cURL command works when I run it at the command line, here is the cURL command:

curl -XGET 'http://scpt-wc-ap.sys.bombast.net:9200/_all/_search?pretty' -d '{

  "query": {

    "filtered": {

      "query": {

        "bool": {

          "should": [

            {

              "query_string": {

                "query": "source:smart_connect"

              }

            }

          ]

        }

      },

      "filter": {

        "bool": {

          "must": [

            {

              "range": {

                "@timestamp": {

                  "from": 1439899750653,

                  "to": 1439903350653

                }

              }

            }

          ]

        }

      }

    }

  },

  "highlight": {

    "fields": {},

    "fragment_size": 2147483647,

    "pre_tags": [

      "@start-highlight@"

    ],

    "post_tags": [

      "@end-highlight@"

    ]

  },

  "size": 500,

  "sort": [

    {

      "_score": {

        "order": "desc",

        "ignore_unmapped": true

      }

    }

  ]

}'

the error looks like:

enter image description here

any idea what is wrong the cURL command? Like I said it works when I run it at the command line.

Perhaps you can just help me translate the cURL command into HTTP, I assume it's an HTTP GET, but I don't know what the -d flag is doing besides passing data in some form.

like image 638
Alexander Mills Avatar asked Dec 14 '22 12:12

Alexander Mills


1 Answers

Your curl command needs a space between -X and GET

see curl -GET and -X GET for more information about curl curl GET vs curl -X GET

Edit: It looks like this is just a postman thing, weird. Bug Maybe?

I was able to successfully import your request into postman using this:

curl -X GET 'http://scpt-wc-ap.sys.bombast.net:9200/_all/_search?pretty' -d '{"query":{"filtered":{"query":{"bool":{"should":[{"query_string":{"query":"source:smart_connect"}}]}},"filter":{"bool":{"must":[{"range":{"@timestamp":{"from":1439899750653,"to":1439903350653}}}]}}}},"highlight":{"fields":{},"fragment_size":2147483647,"pre_tags":["@start-highlight@"],"post_tags":["@end-highlight@"]},"size":500,"sort":[{"_score":{"order":"desc","ignore_unmapped":true}}]}'
like image 147
AgrahamLincoln Avatar answered Dec 18 '22 11:12

AgrahamLincoln