Genesys Cloud - Main

 View Only

Discussion Thread View
Expand all | Collapse all

Read the output from json response to output variables in Data action contract.

  • 1.  Read the output from json response to output variables in Data action contract.

    Posted 07-30-2024 11:22
    Edited by Karthik Ageer 07-31-2024 09:16

    Hi All,

    We have a table in Google BigQuery that contains a list of orders. I am working on fetching the list of orders and their attributes for a particular customer using Data action. Since one customer can have multiple orders, the API will return multiple rows.

    I am able to make the API request using a Data Action and retrieve the list of order IDs for a particular customer. However, I am unable to parse the JSON response and assigning it to an output variable/contract. 

    Can you please guide me on this. 

    {
      "rows.f.v": [
        [
          "test@test.com",
          "112335",
          "2024-04-15",
          "Pending",
          "Visa Card ending 1234",
          "2S100023546785",
          "CustomerName"
        ],
        [
          "test@test.com",
          "657845",
          "2024-03-15",
          "Shipped",
          "Visa Card ending 1234",
          "2S100023546785",
          "CustomerName"
        ],
        [
          "test@test.com",
          "566542",
          "2024-03-25",
          "Shipped",
          "Visa Card ending 1234",
          "2S100023546785",
          "CustomerName"
        ]
      ]
    }


    #API/Integrations
    #Implementation

    ------------------------------
    Karthik Ageer
    Computer Generated Solutions, Inc.
    ------------------------------



  • 2.  RE: Read the output from json response to output variables in Data action contract.

    GENESYS
    Posted 07-30-2024 17:41

    Hello Karthik,

    Are you getting any errors when you try to parse the JSON response with a Data Action?



    ------------------------------
    Jason Kleitz
    Genesys - Employees
    ------------------------------



  • 3.  RE: Read the output from json response to output variables in Data action contract.

    Posted 07-31-2024 09:38

    No errors now after i matched the output contract to the response. Thank you. How can i access this rows object from the architect ? 



    ------------------------------
    Karthik Ageer
    Computer Generated Solutions, Inc.
    ------------------------------



  • 4.  RE: Read the output from json response to output variables in Data action contract.

    Top 25 Contributor
    Posted 07-30-2024 18:38

    Hi Karthik

    That looks like the flattened results, when testing the data action untick flatten results, the base raw results is what you want to build your output contract around not the flattened results.



    ------------------------------
    Anton Vroon
    ------------------------------



  • 5.  RE: Read the output from json response to output variables in Data action contract.

    Posted 07-31-2024 09:37

    Thank you it is worked for me after i matched the output contract to unflattened json response.  I am just thinking about the next steps how can i access this rows object from the architect ? 

    {
      "rows": [
        {
          "f": [
            {
              "v": "test@test.com"
            },
            {
              "v": "112335"
            },
            {
              "v": "2024-04-15"
            },
            {
              "v": "Pending"
            },
            {
              "v": "Visa Card ending 1234"
            },
            {
              "v": "2S100023546785"
            },
            {
              "v": "CustomerName"
            }
          ]
        },
        {
          "f": [
            {
              "v": "test@test.com"
            },
            {
              "v": "657845"
            },
            {
              "v": "2024-03-15"
            },
            {
              "v": "Shipped"
            },
            {
              "v": "Visa Card ending 1234"
            },
            {
              "v": "2S100023546785"
            },
            {
              "v": "CustomerName"
            }
          ]
        },
        {
          "f": [
            {
              "v": "test@test.com"
            },
            {
              "v": "566542"
            },
            {
              "v": "2024-03-25"
            },
            {
              "v": "Shipped"
            },
            {
              "v": "Visa Card ending 1234"
            },
            {
              "v": "2S100023546785"
            },
            {
              "v": "CustomerName"
            }
          ]
        }
      ]
    }


    ------------------------------
    Karthik Ageer
    Computer Generated Solutions, Inc.
    ------------------------------



  • 6.  RE: Read the output from json response to output variables in Data action contract.