Parsing an API Response

Last edit: 


This guide will help you parse an API response.

In this example, you will store part of the response in a Property for later reference using GraphQL mutations in callback, since you are able to access response body via response.body.

The tutorial assumes the API returns JSON like:

  "third_party_api_id": "id-1"

and you want store the third_party_api_id value (which is id-1).


To follow the steps in this tutorial, you should understand the concept of users and Properties. You'll use the user profile and API call notification created in previous tutorials.


Parsing an API response is a four-step process:

  1. Create Custom Attribute
  2. Add GraphQL mutation
  3. Create Form Configuration
  4. Extend API call notification with callback

Step 1: Create Custom Attribute

As a first step, create a Property in the user profile. In this example, you will use default_profile.

Step 2: Add GraphQL mutation

Add GraphQL mutation:


mutation store_third_party_api_id($user_id: ID!, $third_party_api_id: String!) {
    id: $user_id
    user: {
      profiles: [
        { name: "default", values: { properties: [{ name: "third_party_api_id", value: $third_party_api_id }] } }
    form_configuration_name: "callback_third_party_api_id"
  ) {

Step 3: Create Form Configuration

The mutation you created provides input for the Form Configuration called callback_third_party_api_id, so create this Form Configuration:


name: callback_third_party_api_id
resource: User

Step 4: Extend API call notification with callback

Extend the API call notification by adding the proper callback, which executes the mutation with the input received form the third party API:


name: ping_example_com_on_user_sign_up
to: '{{ }}'
callback: "{%- assign response_json = response.body | to_hash -%}{% execute_query 'persist_custom_attribute', id:, third_party_api_id: response_json.third_party_api_id %}"

Next steps

Congratulations! You know how to parse an API response. Now you can learn about Transactables.


We are always happy to help with any questions you may have. Check out our Help page, or contact us.