Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Nested array output response is not coming properly

    Posted 18 days ago
    Edited by Pooja Kumari 18 days ago

    I am creating a data action which is for telecom. Having balance for voice, sms and data, but issue is that i am getting all response in data action but not while  calling action in architect .I am getting available balance (value as well) , Voice_roam as string collection which is giving count= 0 always what i am doing wrong ?? 

    response :-{
      "translationMap": {
        "Voice_roam": "$.productBalances[0].balances[0].voice",
        "Voice_std": "$.productBalances[0].balances[1].voice",
        "availableBalance": "$['primaryBalance']['monetary']['availableFormatted']"
      },
      "translationMapDefaults": {
        "Voice_roam": "[]",
        "Voice_std": "[]",
        "availableBalance": "\"0.00\""
      },
      "successTemplate": "{\r\n \"Voice_std\" : ${Voice_std}\r\n,\r\n \"Voice_roam\" : ${Voice_roam}\r\n,\r\n \"availableBalance\" : ${availableBalance}\r\n}"
    }

    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "object",
      "properties": {
        "primaryBalance": {
          "type": "object",
          "properties": {
            "monetary": {
              "type": "object",
              "properties": {
                "availableFormatted": {
                  "type": "string"
                }
              }
            }
          }
        },
        "productBalances": {
          "type": "array",
          "items": [
            {
              "type": "object",
              "properties": {
                "balances": {
                  "type": "array",
                  "items": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "voice": {
                          "type": "object",
                          "properties": {
                            "availableRaw": {
                              "type": "integer"
                            },
                            "carriedRaw": {
                              "type": "integer"
                            },
                            "maximumRaw": {
                              "type": "integer"
                            },
                            "available": {
                              "type": "integer"
                            },
                            "carried": {
                              "type": "integer"
                            },
                            "maximum": {
                              "type": "integer"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "sms": {
                          "type": "object",
                          "properties": {
                            "availableRaw": {
                              "type": "integer"
                            },
                            "carriedRaw": {
                              "type": "integer"
                            },
                            "maximumRaw": {
                              "type": "integer"
                            },
                            "available": {
                              "type": "integer"
                            },
                            "carried": {
                              "type": "integer"
                            },
                            "maximum": {
                              "type": "integer"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "carriedRaw": {
                              "type": "number"
                            },
                            "carried": {
                              "type": "string"
                            },
                            "carriedDataType": {
                              "type": "string"
                            },
                            "availableRaw": {
                              "type": "number"
                            },
                            "available": {
                              "type": "string"
                            },
                            "availableDataType": {
                              "type": "string"
                            },
                            "maximumRaw": {
                              "type": "number"
                            },
                            "maximum": {
                              "type": "string"
                            },
                            "maximumDataType": {
                              "type": "string"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "dataOnly": {
                          "type": "boolean"
                        }
                      }
                    }
                  ]
                },
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "subType": {
                  "type": "string"
                },
                "descriptor": {
                  "type": "string"
                },
                "renews": {
                  "type": "boolean"
                },
                "expires": {
                  "type": "boolean"
                },
                "primary": {
                  "type": "boolean"
                },
                "endDate": {
                  "type": "string"
                }
              }
            },
            {
              "type": "object",
              "properties": {
                "balances": {
                  "type": "array",
                  "items": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "voice": {
                          "type": "object",
                          "properties": {
                            "availableRaw": {
                              "type": "number"
                            },
                            "carriedRaw": {
                              "type": "integer"
                            },
                            "maximumRaw": {
                              "type": "number"
                            },
                            "available": {
                              "type": "integer"
                            },
                            "carried": {
                              "type": "integer"
                            },
                            "maximum": {
                              "type": "integer"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "sms": {
                          "type": "object",
                          "properties": {
                            "availableRaw": {
                              "type": "number"
                            },
                            "carriedRaw": {
                              "type": "integer"
                            },
                            "maximumRaw": {
                              "type": "number"
                            },
                            "available": {
                              "type": "integer"
                            },
                            "carried": {
                              "type": "integer"
                            },
                            "maximum": {
                              "type": "integer"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "carriedRaw": {
                              "type": "integer"
                            },
                            "carried": {
                              "type": "string"
                            },
                            "carriedDataType": {
                              "type": "string"
                            },
                            "availableRaw": {
                              "type": "number"
                            },
                            "available": {
                              "type": "string"
                            },
                            "availableDataType": {
                              "type": "string"
                            },
                            "maximumRaw": {
                              "type": "number"
                            },
                            "maximum": {
                              "type": "string"
                            },
                            "maximumDataType": {
                              "type": "string"
                            },
                            "unlimited": {
                              "type": "boolean"
                            },
                            "startDateTime": {
                              "type": "string"
                            },
                            "endDateTime": {
                              "type": "string"
                            }
                          }
                        },
                        "dataOnly": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "name",
                        "voice",
                        "sms",
                        "data",
                        "dataOnly"
                      ]
                    }
                  ]
                },
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "subType": {
                  "type": "string"
                },
                "descriptor": {
                  "type": "string"
                },
                "renews": {
                  "type": "boolean"
                },
                "expires": {
                  "type": "boolean"
                },
                "primary": {
                  "type": "boolean"
                },
                "endDate": {
                  "type": "string"
                }
              }
            }
          ]
        }
      },
      "required": [
        "primaryBalance",
        "productBalances"
      ]
    }


    #API/Integrations
    #ArchitectureandDesign

    ------------------------------
    Pooja Kumari
    -
    ------------------------------



  • 2.  RE: Nested array output response is not coming properly

    Posted 18 days ago

    Hi Pooja,

    This could be worth opening a case with care to help clarify the issue as they may need to look at the logging to see whats happening. 
    But maybe someone in the community might have a good suggestion of what you need to check.



    ------------------------------
    Sam Jillard
    Online Community Manager/Moderator
    Genesys - Employees
    ------------------------------



  • 3.  RE: Nested array output response is not coming properly
    Best Answer

    Posted 17 days ago

    Data actions don't like nested arrays and the best way to extract with a Response Template.  The other best way would be to bring in the raw response and use the JSON tools in Architect to extract the arrays.  JSON values in Architect - Genesys Cloud Resource Center



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



Need Help finding something?

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