Skip to main content
Participating Frequently
Apr 21, 2023 6:59 PM UTC
Question

web API integration

Hi,

I have an API that has an output that looks like below. can anyone suggest to me how to add data to the database without changing any output from the API?

    8 replies

    gopalk2865
    Participating Frequently
    Apr 22, 2023 4:37 AM UTC

    HI, Convert your api output data into a cdt and then you can write the data into DB easily . Whats the issue you are getting while adding these data into db?

    Participating Frequently
    Apr 24, 2023 12:19 PM UTC

    Hi Gopal K,

    as the data is nested, it shows only the first values and the rest of them are null.

    Can you explain how to convert api data into a CDT?

    stefanhelzle0001
    Brainy
    Apr 24, 2023 12:22 PM UTC

    You can just cast any data structure to a CDT. Appian will then match the fields by name.

    stefanhelzle0001
    Brainy
    Apr 22, 2023 7:52 AM UTC

    This seems to be a deeply nested self-referencing structure. You will have to analyze the structure and turn it into a data model that you can store in a relational database. Appian is moving towards Records and suggest to not use CDTs for any new developments.

    harshitb6843
    Brainy
    Apr 22, 2023 10:23 AM UTC

    Like others said, you need to convert the output in various CDTs and then save it, if you want to filter and report on this data later. Else, you can just cast this data into a JSON using a!toJson() and just store it as a string value. 

    abhayd3663
    Brainy
    Apr 24, 2023 1:36 PM UTC

    Create CDT with the exact same structure as the API output with nesting and the casting should work fine.