Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-27-2023 15:16
    No replies, thread closed.

    I am trying to use the API "POST /api/v2/flows/datatables/{datatableId}/rows" to add a new row, but I couldn't get it right. The instruction following "Create a new row entry for the datatable. Will add the passed in row entry to the datatable with the given datatableId after verifying it against the schema. The DataTableRow should be a json-ized' stream of key -> value pairs { "Field1": "XYZZY", "Field2": false, "KEY": "27272" }" doesn't work.  Can anyone help me on this? What is the value of the key? how can we get it? Thank you!


    #ArchitectureandDesign

    ------------------------------
    Julie Chen
    SAIC
    ------------------------------


  • 2.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-27-2023 17:50
    No replies, thread closed.

    Hi

    "Key" refers to the "Reference Key Label" of your Data Table which is the first column. 

    To assist without knowing the specifics, I suggest to create a manual entry in your data table (or if you already have an entry) then use following API in API Explorer to get a specific row

    GET /api/v2/flows/datatables/{datatableId}/rows/{rowId}
    datatableId: <ID of your Data Table>
    rowId: <key i.e. entry against the Reference Key Label of that row>
    showbrief: false

    Response that you will get from above API, copy the whole thing into the Body of your POST  /api/v2/flows/datatables/{datatableId}/rows and modify the values as needed then execute.

    Hope this helps



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 3.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-28-2023 09:56
    Edited by Julie Chen 07-28-2023 09:56
    No replies, thread closed.

    Zubair, 

    Thank you for your answer.  I need to insert/update data table with external resource, insert/update will be needed in this case.  Would you please give me an example about insert?  The following is what I did with API POST /api/v2/flows/datatables/{datatableId}/rows



    ------------------------------
    Julie Chen
    SAIC
    ------------------------------



  • 4.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-28-2023 15:16
    No replies, thread closed.

    The body schema appears incorrect to me. What field is 0001001 value linked to in your data table? Can you provide screenshot of data table so i can see column headers



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 5.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-28-2023 16:12
    Edited by Julie Chen 07-28-2023 16:35
    No replies, thread closed.

    Zubair,

    Never mind. The browser version API explorer that generates json data is not correct, so I have never got right. My boss helped me and found your another post https://community.genesys.com/discussion/api-explorer-and-data-actions" title="https://community.genesys.com/discussion/api-explorer-and-data-actions" href="https://community.genesys.com/discussion/api-explorer-and-data-actions" rel="noreferrer noopener" target="_blank" class="fui-Link ___1eya986 f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1hu3pq6 f11qmguv f19f4twv f1tyq0we f1g0x7ka fhxju0i f1qch9an f1cnd47f fqv5qza f1vmzxwi f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1x7u7e9 f10aw75t fsle3fq f17ae5zn">https://community.genesys.com/discussion/api-explorer-and-data-actions

    If I use Develop Tool to test the API, it works perfect.

    Thank you!



    ------------------------------
    Julie Chen
    SAIC
    ------------------------------



  • 6.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-28-2023 18:05
    No replies, thread closed.

    I am surprised that its still not fixed! I myself raised a case with care about this back in March and I was told this is a known issue.



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 7.  RE: how to insert a new row into data table with API POST /api/v2/flows/datatables/{datatableId}/rows?

    Posted 07-31-2023 11:29
    No replies, thread closed.

    If it helps anyone, here is example code to add a row to a data table using the .NET SDK:

    public class DatatableEntity
    
    {
      [JsonProperty("Enable_Debugging")]
      public bool Enable_Debugging { get; set; }
      public string KEY { get; set; } //whichever parameter/column you use as the key of your datatable is referred to as KEY instead of the name you use for it
    }
    
    private static void addRowToTable() 
    {
    
      DataTableEntity rowEntity = new DataTableEntity();
      rowEntity.KEY = "USA";
      rowEntity.Enable_Debugging = true;
      string datatableId = "1234.blahblahblah..."; //your genesys ID for the datatable in question
    
      try
      {
        //architectApiInstance is an instance of ArchitectAPI defined elsewhere in code
        Dictionary<string,object> result = architectApiInstance.PostFlowsDatatableRows(datatableId, rowEntity); 
      }
      catch (Exception ex) 
      {
        Console.WriteLine("Exception: " +ex.ToString());
      } 
    }


    ------------------------------
    Waqar Mahmood
    Herbalife International of America, Inc.
    ------------------------------