Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Passing array as input in the data action API

    Posted 26 days ago

    We have a use case for where we need to pass input parameter as an array in the data action, but we are unable to pass it.

    Request: for example,

    Request:
    {
    "accountnumber": {
    "zone": {
    "tax": "",
    "location": "",
    "orderdetails": [
    {
    "id": "",
    "quantity": ""
    },
    {
    "id": "",
    "quantity": ""
    }
    ]
    }
    }
    }

     This is for dynamic array. Could anyone provide input how we can achieve this?


    #API/Integrations

    ------------------------------
    Parthiban Kannaiyan
    Cognizant Technology Solutions India Private Limited
    ------------------------------


  • 2.  RE: Passing array as input in the data action API

    Posted 26 days ago

    I have found the only way is to build the input as JSON code in the configuration tab instead of using the contacts.



    ------------------------------
    Robert Wakefield-Carl
    ttec Digital
    Sr. Director - Innovation Architects
    Robert.WC@ttecdigital.com
    https://www.ttecDigital.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Passing array as input in the data action API

    Posted 26 days ago

    Hello Robert,

    Thanks for the update, I have multiple products for the input but how to write the JSON code in the configuration?

    Can you please help me on this?



    ------------------------------
    Parthiban Kannaiyan
    Cognizant Technology Solutions India Private Limited
    ------------------------------



  • 4.  RE: Passing array as input in the data action API
    Best Answer

    Posted 26 days ago

    I would think something like

    {
      "title": "accountnumber",
      "type": "object",
      "properties": {
        "zone": {
          "type": "object",
          "properties": {
            "tax": {
              "type": "string"
            },
            "location": {
              "type": "string"
            },
            "orderdetails": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer"
                  }
                },
                "required": [
                  "id",
                  "quantity"
                ]
              }
            }
          },
          "required": [
            "tax",
            "location",
            "orderdetails"
          ],
          "additionalProperties": true
        }
      },
      "required": [
        "zone"
      ],
      "additionalProperties": true
    }


    ------------------------------
    Jess Peebles
    Spark New Zealand Trading Limited
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources