Preview API data used in Shopify Flow
When you build a workflow, you might often want to use data from your store in conditions and actions. Shopify Flow accesses store data by calling theGraphQL Admin API, which means you have access to nearly all the fields in the API.
As you build a workflow, you will often encounter field names and descriptions based on the API, but you might need to know what data is output by the API. For example, you might want to know the app name for an order that was created from a draft order. In addition, you might want to make sure that your workflow outputs the data that you are expecting, or in the form that you are expecting.
To review the data, you have several options in Shopify Flow.
On this page
Find a field in the Shopify admin
In most cases, the data is available in the Shopify admin.
Use the field in a live workflow
You can build a workflow using actions that help you to to review the data rather than the actions that you plan to use in the final version. For example, suppose that you want to create a workflow that cancels an order. Instead of using theCancel orderaction and potentially canceling the wrong order, you can start by using theSend internal emailaction, or theSend Slack messageaction if you use Slack.
Steps:
- Choose a trigger that can be triggered manually.
- Add an action to the workflow and connect it to the trigger, such asSend internal email.
- Add the variables that you want to inspect to theMessagesection of theSend internal emailaction.
- ClickTurn on workflow.
- Trigger the workflow, either byrunning it manuallyor by causing the trigger to fire. For example, if you're using theOrder createdtrigger, then create a test order.
- After the workflow runs, check your email for the variables.
Refer to the resource JSON page
Most resource pages in the Shopify admin, such as theOrder,Product, orCustomerpages, allow you to view the data that serves the page. This data isn't exactly the same naming and format that Shopify Flow uses, but the values match what is in the GraphQL Admin API. To review the data, add.json
to the URL.
For example, navigate to an order by going in the Shopify admin to theOrderspage and clicking an order. In the address of the page in the address bar of your browser, change the address from:
https://https://admin.shopify.com/store/
To the following:
https://https://admin.shopify.com/store/
Use GraphiQL or a third-party API tool
你可以直接查询使用这个APIrd-party API tool like Postman or the free Shopify-provided tool, GraphiQL. This option provides the most accurate results, but it does require some familiarity with creating GraphQL queries.
For GraphiQL, Shopify offers both aweb-based GraphiQL explorerwith generic data and theGraphiQL app. With GraphiQL, you can build a GraphQL query which exactly matches the field names that you see in Shopify Flow. The values also exactly match your store if you use the app.
By using this tool, you can determine exactly what data Shopify Flow uses, with your real shop data. For example, you create the following query:
In the following results, the variableorder / app / name
displays the app name for the order. In this case, the order was created from the draft orders app, so the value isDraft Orders
. Channel information is only available for thePoint of Sale
应用程序。