# cURL - Could not get simple GET to work

**URL:** <https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831>\
**Category:** Elasticsearch\
**Created:** [April 5, 2018, 3:10am UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831 "2018-04-05T03:10:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aravind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aravind/32/45644_2.png) [@Aravind](https://discuss.elastic.co/u/Aravind)\
**Post date:** [April 5, 2018, 3:10am UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/1 "2018-04-05T03:10:45Z")

</div>

Sorry this could be a basic question as I'm getting started.

I'm performing a simple match all type query via Kibana which just works fine.

Then I just did "Copy as cURL" from kibana which looks likes this -

```
curl -XGET "http://localhost:9200/car/default/_search" -H 'Content-Type: application/json' -d'
{"query": {"match_all": {}}}'

```

and paste it as-is onto my Windows - Powershell but see this error -

PS C:\Users\aravind\> curl -XGET "[http://localhost:9200/car/default/\_search](http://localhost:9200/car/default/_search)" -H 'Content-Type: applica  
tion/json' -d'  
{"error":{"root\_cause":[{"type":"json\_parse\_exception","reason":"Unexpected character (''' (code 39)): expected a valid  
value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.transport.netty4.ByteBu  
fStreamInput@40fb2941; line: 1, column: 2]"}],"type":"json\_parse\_exception","reason":"Unexpected character (''' (code 39  
)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: org.elasticsearch.tr  
ansport.netty4.ByteBufStreamInput@40fb2941; line: 1, column: 2]"},"status":500}PS C:\Users\aravind\> {"query": {"ma  
tch\_all": {}}}'  
Unexpected token ':' in expression or statement.  
At line:1 char:10  
"+ {"query": \<\<\<\< {"match\_all": {}}}'  
+ CategoryInfo : ParserError: (::String) [], ParentContainsErrorRecordException  
+ FullyQualifiedErrorId : UnexpectedToken"

Now when I formatted the cURL like below (provided space between -d and single quote and then also moved the search query portion into first line essentially making the entire command into single line)

```
curl -XGET "http://localhost:9200/car/default/_search" -H 'Content-Type: applica
tion/json' -d '{"query": {"match_all": {}}}'

```

but I get this error -

{"error":{"root\_cause":[{"type":"json\_parse\_exception","reason":"Unexpected character ('q' (code 113)): was expecting do  
uble-quote to start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@54a03843; line: 1, co  
lumn: 3]"}],"type":"json\_parse\_exception","reason":"Unexpected character ('q' (code 113)): was expecting double-quote to  
start field name\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@54a03843; line: 1, column: 3]"},"s  
tatus":500}PS C:\Users\aravind\>

What am I missing ?

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [April 5, 2018, 4:51am UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/2 "2018-04-05T04:51:26Z")

</div>

This post may help: [Curl single quotes vs. double quotes](https://discuss.elastic.co/t/curl-single-quotes-vs-double-quotes/114671)

---

<div class="post-metadata">

**Author:** ![Aravind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aravind/32/45644_2.png) [@Aravind](https://discuss.elastic.co/u/Aravind)\
**Post date:** [April 5, 2018, 5:45am UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/3 "2018-04-05T05:45:58Z")

</div>

Thanks ... Seems like this is hard-time with Windows.

Atleast I'm trying to see how to get this working on Postman. I can get every other thing working than this search on post man. How should I specify

`{"query": {"match_all": {}}}'`

in Postman

or even this one

`{"query": {"match": { "name" : "Honda" }}}`

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [April 5, 2018, 6:15am UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/4 "2018-04-05T06:15:54Z")

</div>

You should better use Kibana and its developer Console. Much easier.

---

<div class="post-metadata">

**Author:** ![Aravind](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aravind/32/45644_2.png) [@Aravind](https://discuss.elastic.co/u/Aravind)\
**Post date:** [April 5, 2018, 10:10pm UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/5 "2018-04-05T22:10:39Z")

</div>

Sure, thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 3, 2018, 10:10pm UTC](https://discuss.elastic.co/t/curl-could-not-get-simple-get-to-work/126831/6 "2018-05-03T22:10:45Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
