Invalid global id and The json provided is not formatted correctly

Solved

Invalid global id and The json provided is not formatted correctly

タイ
Shopify Partner
4 2 1

when i set entity with string:

{"query":"{ order (id:4895903678719) { id }}"}

I received a respone: 

200 OK

"message":"Invalid global id '4895903678719'"

 

when i set entity with string:  

{"query":"{ order (id:"gid://shopify/Order/4895903678719") { id }}"}

I received a : {"status":400,"error":"The json provided is not formatted correctly: Error occurred while parsing request parameters"}

 

Where am i going wrong can you guide me?

 

My sourcre code :

'''

CloseableHttpClient httpClient = HttpClientBuilder.create().build();
HttpPost http = new HttpPost(urlStr);
http.addHeader("x-shopify-access-token", access_token);
http.addHeader("Accept", "application/json");
http.addHeader("Content-Type", "application/json");


HttpEntity entity = new ByteArrayEntity(reqData.getBytes("UTF-8"));
http.setEntity(entity);
HttpResponse response = httpClient.execute(http);

'''

Accepted Solution (1)

タイ
Shopify Partner
4 2 1

This is an accepted solution.

i solved it with request like below:

{"query":"{ order (id:\\\"gid://shopify/Order/4895903678719\\\") { id }}"}

View solution in original post

Reply 1 (1)

タイ
Shopify Partner
4 2 1

This is an accepted solution.

i solved it with request like below:

{"query":"{ order (id:\\\"gid://shopify/Order/4895903678719\\\") { id }}"}