Overview
The Fetch node loads an API from a URL, so the project can pull in the API response. The Fetch node allows you to Get or Post to the API, customize relevant header information for the specific API, and create an error response.
Any API can be used with Play’s Fetch node. API responses contains key-value pairs, which are labels (keys) for data entries (values). Each API has different keys and different headers, so make sure to read the selected API’s documentation.
Important Note About Using API Keys in Play
If you are using any sensitive API keys in your Fetch nodes, these keys are exposed and can be seen by users of your prototypes and apps.
For prototypes, make sure you have your App Clip's password protected and that you are sending to trusted sources.
For Export to Xcode, we recommend you store your keys server side using services like Firebase Cloud Functions, Supabase Edge Functions, or AWS Lambda for secure request handling.
Read this article on using external data to learn how to pull values from an API into your Play prototype using the associated keys.
Action Properties
URL
Enter the URL for the selected API.
HTTP Method
Choose how to interact with the API:
Get: Request data from the API.
Post: Send data to the API to create/update a resource.
Headers
If applicable to the selected API, add the necessary headers. We’ve added several common headers:
“Content-Type” = “application/json”
“Accept” = “application/json”
“Cache-Control” = “no-cache”
“Authorization” = “Bearer YOUR_ACCESS_TOKEN” (Enter your own API token)
Some APIs have additional headers. Add those with a Custom header.
Body Type
When using HTTP Method Post, choose how the data is formatted in the request's body when sent to the API server.
Expression Editor Properties
Response
LocalJSON.response
The information that a server returns to a client after an API request.
On Error
On the On Error section of the Fetch node, add actions that should fire if there is an error accessing the API. This section allows your prototype to respond if an API is down or another issue occurs.