Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dharamgollapudi/70933e1cc0fccc65077671d5ab403075 to your computer and use it in GitHub Desktop.
Save dharamgollapudi/70933e1cc0fccc65077671d5ab403075 to your computer and use it in GitHub Desktop.
{
"_type": "export",
"__export_format": 3,
"__export_date": "2018-11-02T17:49:05.621Z",
"__export_source": "insomnia.desktop.app:v6.0.2",
"resources": [
{
"_id": "wrk_566964f3c7d044748b99b8c814e40d8e",
"created": 1538419476867,
"description": "",
"modified": 1540227329415,
"name": "Shopify GraphQL Learning Kit",
"parentId": null,
"_type": "workspace"
},
{
"_id": "env_894157c00fa94e11ba5c1e1f50ae122f",
"color": null,
"created": 1538419476872,
"data": {},
"isPrivate": false,
"metaSortKey": 1538419476872,
"modified": 1538419476872,
"name": "New Environment",
"parentId": "wrk_566964f3c7d044748b99b8c814e40d8e",
"_type": "environment"
},
{
"_id": "jar_c04033d61be44e7fb73e2e15820467b0",
"cookies": [],
"created": 1538419476893,
"modified": 1538490088623,
"name": "Default Jar",
"parentId": "wrk_566964f3c7d044748b99b8c814e40d8e",
"_type": "cookie_jar"
},
{
"_id": "fld_c59a95142eaa420e9e69d07215dd51f2",
"created": 1538419477515,
"description": "",
"environment": {},
"metaSortKey": -1528735162245,
"modified": 1540227335887,
"name": "Shopify GraphQL Learning Kit",
"parentId": "wrk_566964f3c7d044748b99b8c814e40d8e",
"_type": "request_group"
},
{
"_id": "env_7d18de524f12497f900f24910801afad",
"color": "#cb6203",
"created": 1538419623283,
"data": {
"access_token": "add-your-token-here",
"store": "add-your-shopify-store-token-here"
},
"isPrivate": false,
"metaSortKey": 1538419623283,
"modified": 1541180354294,
"name": "my-test-store-details",
"parentId": "env_894157c00fa94e11ba5c1e1f50ae122f",
"_type": "environment"
},
{
"_id": "fld_dae638a1398146a2981692be2271de43",
"created": 1538419477516,
"description": "",
"environment": {},
"metaSortKey": -1537452659922,
"modified": 1538419477516,
"name": "Query Structure Examples",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "fld_b6048de6a40d4142b76ba0f2eeeecb38",
"created": 1538419477543,
"description": "",
"environment": {},
"metaSortKey": -1537452659872,
"modified": 1538419477543,
"name": "Mutation Structure Examples",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "fld_ca2ede05d84b44bc83e1d042eace2c5f",
"created": 1538419477569,
"description": "",
"environment": {},
"metaSortKey": -1537452659840.75,
"modified": 1538419477569,
"name": "Pagination",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "fld_79fb87e2555f4bd9b878d25245c9e2cc",
"created": 1538419477597,
"description": "",
"environment": {},
"metaSortKey": -1537452659847,
"modified": 1538419477597,
"name": "GraphQL Variables",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "fld_8814478359ee4f92807124d1873ec589",
"created": 1538419477610,
"description": "",
"environment": {},
"metaSortKey": -1537812286370,
"modified": 1539273318873,
"name": "Insomnia Configuration",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "fld_b77cd8ee643c444e9880892e6636284b",
"created": 1538419477626,
"description": "",
"environment": {},
"metaSortKey": -1537452659834.5,
"modified": 1538419477626,
"name": "Advanced",
"parentId": "fld_c59a95142eaa420e9e69d07215dd51f2",
"_type": "request_group"
},
{
"_id": "req_f7ac10e899924d39b53dd7c1d9cdf081",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Connections are links between related objects. \\n# These allow you to make nested queries, gathering information from multiple objects by traversing their connections in a single GraphQL call.\\n\\n# When using connections, you’ll want to select the “edges” field.\\n# The edges field is an array of objects of the same type, such as a orders on a shop.\\n# Once you’ve selected the edges, you’ll want to access the individual objects, via the node field.\\n\\n# On the node field, you can select the object fields that you want to get back. \\n# These fields will be selected on each object in the edges array.\\n\\n# Finally, when using a connection, you'll always need to select the number of objects you want returned (either first or last in the set). More on this in Pagination.\\n\\n# This query gets the products connection, which is available from the QueryRoot, and asks for the first 3 products. It selects edges, the node, and fields from each of the returned product objects.\\n# Since products also have a variants connection, we repeat a similar process to get information on the first 3 variants on each of those products.\\n\\n{\\n\\tproducts(first:3) {\\n\\t\\tedges {\\n\\t\\t\\tnode {\\n\\t\\t\\t\\tid\\n\\t\\t\\t\\thandle\\n\\t\\t\\t\\tvariants(first:3) {\\n\\t\\t\\t\\t\\tedges {\\n\\t\\t\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\t\\t\\tid\\n\\t\\t\\t\\t\\t\\t\\tdisplayName\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\"}"
},
"created": 1538419477518,
"description": "",
"headers": [
{
"id": "pair_68ff44ceb6f640d3a69daa8e289bb8d8",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_43d5cff760fb423ab3e4f45ccb4e757f",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454358.25,
"method": "POST",
"modified": 1541167866346,
"name": "Connections and Edges",
"parameters": [],
"parentId": "fld_dae638a1398146a2981692be2271de43",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_0f5d152408a74ef6a12330a003871021",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# The QueryRoot represents easily accessible entry points into the GraphQL Admin API Graph.\\n# - https://help.shopify.com/en/api/graphql-admin-api/reference/queryroot\\n# To use this page, search for a resource that interests you (CTRL+F the page), and click through to learn more. \\n\\n# In our example, we'll take another look at the Shop resource, since it is a single object.\\n# Objects represent concepts such as the Shop, or a single Order, and contain data in fields.\\n\\n# In GraphQL, we always have to select what we want to have returned to us from the available fields.\\n\\n# Alternatively, Insomnia will auto-complete valid fields as you type when selecting fields, so feel free to modify the query below to get more or less information back.\\n\\n# This query gets the Shop object, and specifies which fields we want returned.\\n\\n\\n{\\n shop {\\n\\t\\t\\tid\\n\\t\\t\\tname\\n\\t\\t\\tdescription\\n\\t\\t\\temail\\n\\t\\t}\\n}\\n\\n# You might notice that you get what you asked for, and then some.\\n# In the returned JSON payload, you should see two top level keys, “data” and “extensions”.\\n# - “Data” is always what you’ve just requested in your query.\\n# - “Extensions” is extra information that Shopify has added, such as the cost of your query.\\n# We’ll take a look a closer look at cost another time, so for now don’t worry about it.\\n# - https://help.shopify.com/en/api/graphql-admin-api/call-limit\\n\\n\"}"
},
"created": 1538419477523,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454408.25,
"method": "POST",
"modified": 1541167589875,
"name": "QueryRoot Objects",
"parameters": [],
"parentId": "fld_dae638a1398146a2981692be2271de43",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_c19c3f7b65d1424e835db845660fe856",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Access through connections is great, but sometimes we might want something more direct.\\n# Thankfully, we can also access an object directly through its GraphQL ID.\\n\\n# Looking at our QueryRoot documentation once again, we can see that there are multiple queries that require a single GraphQL ID as an input, and return that object.\\n# - https://help.shopify.com/en/api/graphql-admin-api/reference/queryroot\\n# It’s good practice to always select the ID of any objects you’re querying, so that you can refer to it directly later on.\\n\\n# Note: \\n# Make sure that you're using a GraphQL ID here, and not just copy-pasting a REST ID.\\n# The Migrating from REST guide has more information on obtaining GraphQL IDs from REST.\\n# - https://help.shopify.com/en/api/graphql-admin-api/migrating_from_rest#translating-from-rest-ids-to-graphql-ids\\n\\n# This query gets a single product via the ID, and specifies which fields we want returned.\\n# You can easily get a product Graphql ID for this query from the response to our previous \\\"Connections and Edges\\\" query. \\n# If you don't do this, you'll get a \\\"null\\\" response since you're looking for a product ID that doesn't exist within your shop.\\n\\n{\\n product(id: \\\"gid://shopify/Product/1730990145609\\\") {\\n id\\n\\t\\thandle\\n\\t\\tvariants (first:5) {\\n\\t\\t\\tedges {\\n\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\ttitle\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\\n\"}"
},
"created": 1538419477526,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454258.25,
"method": "POST",
"modified": 1541167892181,
"name": "Single Object by ID",
"parameters": [],
"parentId": "fld_dae638a1398146a2981692be2271de43",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_a4194e4adda74e92a67228da1fe0aab0",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# On many connections, you'll want to filter down the list of edges to find the specific object that you are actually interested in (i.e. the specific `node`s in the collection of `edges`).\\n\\n# You can find out which fields a connection supports filtering on by referencing the `query` parameter on that connection's reference page in the docs.\\n# As for formatting the filter, the syntax follows the search-syntax guide.\\n# - https://help.shopify.com/en/api/getting-started/search-syntax\\n\\n# This query finds the first 10 orders that are fulfilled.\\n\\n{\\n orders(first:10, query:\\\"fulfillment_status:fulfilled\\\") {\\n\\t\\t\\tedges {\\n\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\tid\\n\\t\\t\\t\\t\\tname\\n\\t\\t\\t\\t\\tdisplayFulfillmentStatus\\t\\t\\t\\t\\t\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n}\"}"
},
"created": 1538419477536,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454308.25,
"method": "POST",
"modified": 1541167881721,
"name": "Filtering connections using the query parameter",
"parameters": [],
"parentId": "fld_dae638a1398146a2981692be2271de43",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_d6b7e7360ac3456f89c6769689c97662",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Mutations are the equivalent to REST’s POST actions, and allow you to create and modify objects.\\n# They aren't tied directly to resources, so identifying what they will do usually comes down to naming convention and reading the documentation.\\n\\n# As with queries, in GraphQL, you always have to select what data you want returned.\\n# Usually mutations will return the object that was created/modified, giving you a great opportunity to select the GraphQL ID (especially after a create), as well as verify any key data.\\n\\n# Finally, mutations always include a \\\"userErrors\\\" field. This field lets you know if anything is wrong with your mutation, and why it may not have been processed as expected.\\n\\n# You should ALWAYS be selecting the userErrors field to help with your own troubleshooting. If nothing went wrong, the “userErrors” field will be empty.\\n\\n# This mutation creates a new customer.\\n# We're also passing in the input, which is a JSON object that contains the data we want our customer to have.\\n# Mutations generally require inputs, and you can see which fields you can add to this input hash by checking the docs.\\n# First, look at the mutation and see what type of input it is expecting.\\n# Second, check that input's docs for all available fields. Here's an example:\\n# - https://help.shopify.com/en/api/graphql-admin-api/reference/input_object/customerinput\\n\\n# Note: If you get an \\\"Access Denied\\\" error message, make sure your app has the Customer Read/Write Permission.\\n\\n# We'll select these fields as well, to confirm that they've been properly set.\\nmutation {\\n customerCreate (\\n input: {\\n firstName: \\\"GraphQL\\\",\\n lastName: \\\"Customer\\\",\\n email: \\\"[email protected]\\\"\\n }\\n ) \\n {\\n customer {\\n id\\n firstName\\n lastName\\n email\\n }\\n userErrors {\\n field\\n message\\n }\\n }\\n}\\n\"}"
},
"created": 1538419477545,
"description": "",
"headers": [
{
"id": "pair_689e68621d8740b3bb141cffd328e271",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_ffdef0dbeb8146bd88ce54cd5c52153c",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1537452659859.5,
"method": "POST",
"modified": 1541167936717,
"name": "Basics and Inputs",
"parameters": [],
"parentId": "fld_b6048de6a40d4142b76ba0f2eeeecb38",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_5d74854a37034cb680fb556bde5b395e",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Mutation inputs can also require IDs, such as when creating a order.\\n\\n# From the previous mutation, you should have received the customer's GraphQL ID back after creation (if you selected it). Let's go ahead and use that to create a new order for this customer.\\n\\n# In order to properly format our input, we’ll refer to the reference docs for draftOrderCreate, DraftOrderInput, and DraftOrderLineItemInput.\\n\\n# Insomnia should be auto-completing field names from what's available to you, so the docs aren't 100% necessary, as the schema is loaded by Insomnia automatically!\\n\\n# Note: If you get an \\\"Access Denied\\\" error message, make sure your app has the DraftOrders Read/Write Permission.\\n\\n# mutation - draftOrderCreate\\n# https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/draftordercreate\\n\\n# input - draftOrderInput\\n# https://help.shopify.com/en/api/graphql-admin-api/reference/input_object/draftorderinput\\n\\n# input for lineItems - DraftOrderLineItemInput\\n# https://help.shopify.com/en/api/graphql-admin-api/reference/input_object/draftorderlineiteminput\\n\\n\\nmutation {\\n draftOrderCreate(\\n\\t\\tinput: {\\n\\t\\t\\tcustomerId: \\\"gid://shopify/Customer/870935789641\\\",\\n\\t\\t\\tlineItems: [\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\ttitle: \\\"My custom line item!\\\",\\n\\t\\t\\t\\t\\tquantity: 1,\\n\\t\\t\\t\\t\\toriginalUnitPrice: 10\\n\\t\\t\\t\\t},\\n\\t\\t\\t\\t{\\n\\t\\t\\t\\t\\ttitle: \\\"My SECOND custom line item!\\\",\\n\\t\\t\\t\\t\\tquantity: 3,\\n\\t\\t\\t\\t\\toriginalUnitPrice: 3.99\\n\\t\\t\\t\\t}\\n\\t\\t\\t]\\n\\t\\t}\\n\\t) \\n\\t{\\n userErrors {\\n field\\n message\\n }\\n draftOrder {\\n\\t\\t\\tid\\n\\t\\t\\tcustomer {\\n\\t\\t\\t\\tid\\n\\t\\t\\t\\temail\\n\\t\\t\\t}\\n\\t\\t}\\n }\\n}\"}"
},
"created": 1538419477554,
"description": "",
"headers": [
{
"id": "pair_689e68621d8740b3bb141cffd328e271",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_ffdef0dbeb8146bd88ce54cd5c52153c",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1537452659822,
"method": "POST",
"modified": 1541168201543,
"name": "Inputs v2",
"parameters": [],
"parentId": "fld_b6048de6a40d4142b76ba0f2eeeecb38",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_5838c7a70e314ef6b4abedb9a397c97b",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# What is pageInfo?\\n# In order to optimize the amount of data and objects we're querying, let's take a look a pagination.\\n\\n# When requesting connections, we have to always request a subset of the full results, with either the \\\"first\\\" or \\\"last\\\" argument.\\n# This means that when looking at \\\"orders\\\", we'll only see the first X orders, and then be able to select which fields we want from those orders.\\n# This is great for items that show up in the first (or last) X, but how do we get more central elements?\\n\\n# On every connection, there is a \\\"pageInfo\\\" field, on the same level as edges.\\n# pageInfo tells us information about the current subset of the connection that we've requested.\\n# Of note, we want to check out the \\\"hasNextPage\\\" field, which returns true if there are more elements in the connection that the current subset isn't showing.\\n\\n# This query gets the first 10 orders, and also asks if there are any more orders.\\n\\nquery getFirstOrders($numOrders: Int, $numLineItems: Int)\\n{\\n\\torders(first:$numOrders) {\\n\\t\\tpageInfo {\\n\\t\\t\\thasNextPage\\n\\t\\t}\\n\\t\\tedges {\\n\\t\\t\\tnode {\\n\\t\\t\\t\\tid\\n\\t\\t\\t\\tlineItems (first:$numLineItems) {\\n\\t\\t\\t\\t\\tedges {\\n\\t\\t\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\t\\t\\tid\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\",\"variables\":{\"numOrders\":10,\"numLineItems\":5},\"operationName\":\"getFirstOrders\"}"
},
"created": 1538419477571,
"description": "",
"headers": [
{
"id": "pair_68ff44ceb6f640d3a69daa8e289bb8d8",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_43d5cff760fb423ab3e4f45ccb4e757f",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454333.25,
"method": "POST",
"modified": 1541168306541,
"name": "What is PageInfo?",
"parameters": [],
"parentId": "fld_ca2ede05d84b44bc83e1d042eace2c5f",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_82b2817fc2094754973d582cf732d847",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# For pagination, knowing that the next set (of X objects) in the connection exists won't be enough. We'll also have to find a way to refer to it.\\n\\n# Cursors are references to a node (object) within the context of a connection’s edges. By slightly modifying our query, we can ask for nodes before or after that cursor.\\n\\n# Let's take another look at our previous query, and also ask for the current edge's cursor.\\n\\n# This query gets the first 10 orders, and also asks if there are any more orders. It also asks for that edge's cursor.\\n\\nquery getFirstOrdersCursor($numOrders: Int, $numLineItems: Int)\\n{\\n\\torders(first:$numOrders) {\\n\\t\\tpageInfo {\\n\\t\\t\\thasNextPage\\n\\t\\t}\\n\\t\\tedges {\\n\\t\\t\\tcursor\\n\\t\\t\\tnode {\\n\\t\\t\\t\\tid\\n\\t\\t\\t\\tlineItems (first:$numLineItems) {\\n\\t\\t\\t\\t\\tedges {\\n\\t\\t\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\t\\t\\tid\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\",\"variables\":{\"numOrders\":10,\"numLineItems\":5},\"operationName\":\"getFirstOrdersCursor\"}"
},
"created": 1538419477577,
"description": "",
"headers": [
{
"id": "pair_68ff44ceb6f640d3a69daa8e289bb8d8",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_43d5cff760fb423ab3e4f45ccb4e757f",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454320.75,
"method": "POST",
"modified": 1541168330511,
"name": "The Cursor",
"parameters": [],
"parentId": "fld_ca2ede05d84b44bc83e1d042eace2c5f",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_ac5d3e9133224d159119f2603cef39c1",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# With the cursor, we're fully prepared to iterate through our whole connection.\\n\\n# On every connection, you can specify the \\\"after\\\" argument, which tells the server to return results to you after this specific cursor. \\n# Use the value that was returned for “cursor” in the previous query as the “after” argument in this query to get the next set of edges.\\n# Don’t forget to replace the included cursor variable value with your own.\\n\\n# Note: This is essentially equivalent to using \\\"since_id\\\" on the REST Admin API.\\n\\n# Let's take another look at our previous query, and also ask for the current edge's cursor.\\n\\nquery getFirstOrdersWithCursor($numOrders: Int, $numLineItems: Int, $cursor: String)\\n{\\n\\torders(first:$numOrders, after:$cursor) {\\n\\t\\tpageInfo {\\n\\t\\t\\thasNextPage\\n\\t\\t}\\n\\t\\tedges {\\n\\t\\t\\tcursor\\n\\t\\t\\tnode {\\n\\t\\t\\t\\tid\\n\\t\\t\\t\\tlineItems (first:$numLineItems) {\\n\\t\\t\\t\\t\\tedges {\\n\\t\\t\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\t\\t\\tid\\n\\t\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\",\"variables\":{\"numOrders\":10,\"numLineItems\":5,\"cursor\":\"eyJsYXN0X2lkIjo2OTA1NzE5MzU4MTcsImxhc3RfdmFsdWUiOiIyMDE3LTExLTIxIDE0OjE3OjAzIn0=\"},\"operationName\":\"getFirstOrdersWithCursor\"}"
},
"created": 1538419477586,
"description": "",
"headers": [
{
"id": "pair_68ff44ceb6f640d3a69daa8e289bb8d8",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_43d5cff760fb423ab3e4f45ccb4e757f",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454314.5,
"method": "POST",
"modified": 1541168350778,
"name": "The Cursor v2",
"parameters": [],
"parentId": "fld_ca2ede05d84b44bc83e1d042eace2c5f",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_ab194f21bcf74c6e8b3b94f3bd694147",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# GraphQL Variables allow you to re-use the same queries / mutations with different arguments. \\n\\n# In Insomnia, query variables are separated into the lower section of the editor.\\n# For every example that follows, you'll have to add your values to the variables.\\n# Failure to do so means you'll be attempting to query my shop's data, and you should receive a \\\"null\\\" response.\\n\\n# For our example, let's find the draftOrder we just created, and use the ID that was returned to us as part of the variables.\\n\\n# Let's step through, line by line, and see how the variables get pulled into the query.\\n# 1. Declare the type, query or mutation\\n# 2. Optional: give it a name. This let's you identify what a query does at a glance.\\n# 3. Specify the variable names as well as their data type.\\n# -> In this query, we’re saying we’ll use a variable named “id”, which has a type of ID...\\nquery getDraftOrderByID($id: ID!) {\\n\\t# Get the draft order directly by ID.\\n\\t# 1. the \\\"id\\\" is a parameter of the draftOrder query.\\n\\t# 2. the \\\"$id\\\" is our variable, which contains the GraphQL ID of the draftOrder we want to retrieve.\\n\\t# -> ... and this is where we actually use the variable!\\n\\tdraftOrder (id: $id) {\\n\\t\\t# Select which data we want returned\\n\\t\\t# Let's get the total price, which we could compare to what we expected all the line items to cost, just to be sure.\\n\\t\\ttotalPrice\\n\\t\\tlineItems (first: 5) {\\n\\t\\t\\tedges {\\n\\t\\t\\t\\tnode {\\n\\t\\t\\t\\t\\toriginalUnitPrice\\n\\t\\t\\t\\t\\tquantity\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\t}\\n}\",\"variables\":{\"id\":\"gid://shopify/DraftOrder/135477690441\"},\"operationName\":\"getDraftOrderByID\"}"
},
"created": 1538419477599,
"description": "",
"headers": [
{
"id": "pair_8e4503c87a7340e59f00421e3a2bb7a6",
"name": "Content-Type",
"value": "application/json"
},
{
"id": "pair_815acfb7017a4c19b304995616e1badd",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
}
],
"isPrivate": false,
"metaSortKey": -1530037034996.1875,
"method": "POST",
"modified": 1541168204353,
"name": "Variables",
"parameters": [],
"parentId": "fld_79fb87e2555f4bd9b878d25245c9e2cc",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_4e326ca2c6a14ec08c68bcaed8c1c7ec",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# You should see at the top of the frame that we're using the \\\"store\\\" to build out the address for the endpoint.\\n# You can also click \\\"Header\\\" at the top to see which headers we are sending with our request, including the access_token.\\n# Hovering over either of these should show you the value that will be substituted into the request.\\n# If you don’t see your values, ensure you have the right environment selected.\\n# - https://screenshot.click/2018-10-10_11-34-21_mb15k-aovu3.png\\n\\n# Once you've setup these two fields in your environment, try running the below query!\\n# You should get your shop’s name back.\\n\\n{\\n shop {\\n\\t\\t\\tid\\n\\t\\t\\tname\\n\\t\\t}\\n}\"}"
},
"created": 1538419477613,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454383.25,
"method": "POST",
"modified": 1541180366763,
"name": "Run the test query",
"parameters": [],
"parentId": "fld_8814478359ee4f92807124d1873ec589",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_114dc40d492a47d9ae135d83fc9eccf6",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Environment variables are JSON key-value pairs that allow you to refer to values without having to write them out everytime.\\n\\n# For our setup, we'll define two environment variables:\\n# The “store” we'll be interacting with\\n# - If your store is mydevstore.myshopify.com, enter “mydevstore” here\\n# The “access_token” we'll be using\\n# - This is your private app’s password, visible on that app’s page\\n# - https://screenshot.click/2018-10-10_11-13-34_do6bt-ivdkx.png\\n\\n# These will enable you to re-use all the queries in this collection with different shopify stores, just by changing your Insomnia environment variables.\\n\\n# You can set your environment variables by opening the “Manage Environments” Window, and adding your details to the “my-test-store-details” sub-environment.\\n# - https://screenshot.click/2018-10-10_11-13-34_do6bt-ivdkx.png\\n# - https://screenshot.click/2018-10-09_15-13-46_vvupk-2hfs3.png \"}"
},
"created": 1539273393632,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1534133454420.75,
"method": "POST",
"modified": 1541180365655,
"name": "Configure your environment variables",
"parameters": [],
"parentId": "fld_8814478359ee4f92807124d1873ec589",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_7e7b9a34cc6942ae82efe97ec9fcb7bc",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# Fragments are a GraphQL concept that allow you to build some flexibility directly into your query.\\n\\n# They are marked by the \\\"... on <TYPE>\\\" syntax.\\n\\n# Using the \\\"node\\\" field on the QueryRoot, we can ask for specific objects by their ID. \\n# This returns us the object (under the “node” field or as edges under the “nodes” connection) as a node object with a basic type, which won't allow us to request any deeper info.\\n# However, using a fragment, we can ask for more specific type data IF the node is of that type.\\n\\n# This is especially useful on nodes that don't have an easy access point through the QueryRoot, such as a single lineItem.\\n\\n# Let's use everything we've learned so far to find out where a lineItem is stocked, so that we can fulfill it from that location.\\n\\n# This query uses the node QueryRoot field.\\n# We ask for an ID that we obtained from somewhere, such as a line item from our previous order / cursors query.\\n\\nquery getLineItemLocationId($id: ID!) {\\n\\t# Get a node from the queryroot node, type ????\\n node(id: $id) {\\n\\t\\t# Fragment on LineItem (IF lineItem THEN)\\n ... on LineItem {\\n id\\n\\t\\t\\t# What is the lineItem's variant?\\n variant {\\n\\t\\t\\t\\t# What is the variant's inventoryItem?\\n inventoryItem {\\n\\t\\t\\t\\t\\t# What is the first level this item is stocked at?\\n inventoryLevels(first: 1) {\\n edges {\\n node {\\n\\t\\t\\t\\t\\t\\t\\t\\t# Finally, what is the location ID of this level?\\n location {\\n id\\n name\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n}\",\"variables\":{\"id\":\"gid://shopify/LineItem/1588425490505\"},\"operationName\":\"getLineItemLocationId\"}"
},
"created": 1538419477630,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1537452659784.5,
"method": "POST",
"modified": 1541168377380,
"name": "Fragments - Handle Multiple Cases",
"parameters": [],
"parentId": "fld_b77cd8ee643c444e9880892e6636284b",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
},
{
"_id": "req_733ca2ddbba94901b71e6aaa13e5ca58",
"authentication": {},
"body": {
"mimeType": "application/graphql",
"text": "{\"query\":\"# You can submit multiple queries / mutations in a single GraphQL request.\\n\\n# This doesn't really have any rate-limiting benefits, as the query complexities are still added together, but for any other constraint that makes it easier for you to just send 1 multi-request, this is how to do it.\\n\\n# The key points are\\n# 1. Declare the type at the top, query or mutation.\\n# 2. Each individual query must be named. \\n# \\t<your-custom-name>: <query/mutation-name-you-are-invoking>\\n# 3. The queries do not have to be the same\\n# 4. Each individual query must select which fields it wants back\\n\\n# This multi-mutation sets 3 different tags on 3 different customers.\\n\\nmutation {\\n VipGold: customerUpdate(\\n\\t\\tinput: {\\n\\t\\t\\tid: \\\"gid://shopify/Customer/870935789641\\\", \\n\\t\\t\\ttags: [\\\"Gold\\\"]\\n\\t\\t}\\n\\t) \\n\\t{\\n customer {\\n tags\\n }\\n }\\n VipPlatinum: customerUpdate(\\n\\t\\tinput: {\\n\\t\\t\\tid: \\\"gid://shopify/Customer/870602047561\\\", \\n\\t\\t\\ttags: [\\\"Platinum\\\"]\\n\\t\\t}\\n\\t) \\n\\t{\\n customer {\\n tags\\n }\\n }\\n VipDiamond: customerUpdate(\\n\\t\\tinput: {\\n\\t\\t\\tid: \\\"gid://shopify/Customer/870602014793\\\", \\n\\t\\t\\ttags: [\\\"Diamond\\\"]\\n\\t\\t}\\n\\t) \\n\\t{\\n customer {\\n tags\\n }\\n }\\n}\\n\"}"
},
"created": 1538419477641,
"description": "",
"headers": [
{
"id": "pair_ab68dd1397134111a257c91374733a0e",
"name": "X-Shopify-Access-Token",
"value": "{{ access_token }}"
},
{
"id": "pair_48045613ab264331a601ac8c8322139a",
"name": "Content-Type",
"value": "application/json"
}
],
"isPrivate": false,
"metaSortKey": -1537020756483.25,
"method": "POST",
"modified": 1541180354820,
"name": "Multiple Queries - One Request",
"parameters": [],
"parentId": "fld_b77cd8ee643c444e9880892e6636284b",
"settingDisableRenderRequestBody": false,
"settingEncodeUrl": true,
"settingMaxTimelineDataSize": 1000,
"settingRebuildPath": true,
"settingSendCookies": true,
"settingStoreCookies": true,
"url": "https://{{ store }}.myshopify.com/admin/api/graphql.json",
"_type": "request"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment