Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Storefront API update address request issue

Solved

Storefront API update address request issue

str8upmedia
Tourist
5 1 0
Yo!
 
I'm working on implementing an external app at the moment and am currently making requests via the storefront API; I'm trying to figure out how to update the client's physical address to the cart via id
 
I am making the requests raw by sending the X-Shopify-Storefront-Access-Token header, as such I don't have the graphql variable capabilities as documented in the API docs. Would you be able to provide the raw post content or example curl request of a "Populating Shipping Address" call?
for an example on the format i'm working for here is a simple get x products request.
 
Any help would be super appreciated- Cheers, Henry
 
{
  shop {
products(first: 10) {
  pageInfo {
hasNextPage
hasPreviousPage
  }
  edges {
cursor
node {
  id
  handle
  variants(first: 30) {
edges {
  node {
id
  }
}
  }
} 
  }
  
   }
  }
}
Accepted Solution (1)

Alex
Shopify Staff
1561 81 343

This is an accepted solution.

Am I understanding your question correctly in that you want to know what a graphql request looks like using curl? If so, here's what your exaple query would look like:

 

curl -X POST 'https://anprichter-test.myshopify.com/api/graphql.json' \
-d '{"query":"{shop{products(first: 10){pageInfo{hasNextPage\nhasPreviousPage}edges{cursor\nnode{id\nhandle\nvariants(first: 30){edges{node{id}}}}}}}}"}' \
-H 'X-Shopify-Storefront-Access-Token: 2c36d7ecefcd0333dbad32e28f8db86b' \
-H 'Content-Type: application/json'

You're really just posting JSON at the end of the day, so if you want to include variables, the shape of your POST would be like so:

 

{"query": "{shop{id}}", "variables": {"key1": "value": "key2": "value"}}

Hope that helps.

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Reply 1 (1)

Alex
Shopify Staff
1561 81 343

This is an accepted solution.

Am I understanding your question correctly in that you want to know what a graphql request looks like using curl? If so, here's what your exaple query would look like:

 

curl -X POST 'https://anprichter-test.myshopify.com/api/graphql.json' \
-d '{"query":"{shop{products(first: 10){pageInfo{hasNextPage\nhasPreviousPage}edges{cursor\nnode{id\nhandle\nvariants(first: 30){edges{node{id}}}}}}}}"}' \
-H 'X-Shopify-Storefront-Access-Token: 2c36d7ecefcd0333dbad32e28f8db86b' \
-H 'Content-Type: application/json'

You're really just posting JSON at the end of the day, so if you want to include variables, the shape of your POST would be like so:

 

{"query": "{shop{id}}", "variables": {"key1": "value": "key2": "value"}}

Hope that helps.

 

Cheers.

Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog