15
Views
6
Comments
Having issues importing my text data (form API) to DB
Question

Hello, 

I keep getting this error: "'apidata' data type required instead of 'Text'.", but my I set apidata to text data..

If you look at my picture, I am able to see the "output" in the message step, but when I try to take that "output" and add it to my entity, I keep getting that error. 

I'm not sure what I'm doing wrong atm. Thank you!




Screen Shot 2023-09-22 at 12.15.13 AM.png
Screen Shot 2023-09-22 at 12.18.08 AM.png
Screen Shot 2023-09-22 at 12.18.52 AM.png
2020-11-25 10-45-32
Mostafa Othman
Champion

Hello Alex,

I think you get confused because you name entity and its attribute with same name. So Please try to change name of one of them.

For action AddtoDB you need to send input parameters as record of entity apidata not text so this is the issue when you can this action after calling API.

If you will always insert returned response from API to table so you can change input parameter of action AddtoDB to be text and then inside action into CreateUpdate action expand record and set Id value as NullIdentifier() and apidata to your input parameter

In case you may insert or update existing record so you need to get existing record from entity and update value of apidata with new one then call CreateUpdate action


UserImage.jpg
Alex Chen

Got it, let me give that a try. 

And doing it this way would allow me to store "output" (which is the api response (json formatted obeject)) into the entity attribute?

2020-11-25 10-45-32
Mostafa Othman
Champion

Yes, if output of API is text not a structure of number of attributes you can change input parameter in your action to text and this will work.

2021-06-01 05-56-33
Komal Kumbhar

Hi Alex, 

you should have the attributes same as API response  in your structure or Entity in which you are saving the API response. 

In your screenshot it just one attribute ApiData in which you are storing everything that API is returning. First of all try to check the API response then create your entity according to it and then use CRUD operation to store the API response to Database. 

Komal

UserImage.jpg
Alex Chen

My goal was to store the whole api response into a single entity attribute. 

I'm able to get a response from the API, which returns an text (unstructured json object). 

how would I can store the whole api response to a single entity  attribute? 

My goal is to then save each entity attribute to a json file, which I will then display as a downloadable files on my page. 

2021-06-01 05-56-33
Komal Kumbhar

Hello,

To achieve this you need to use JSONDeserialize to convert whole API response to single attribute then store the output of JSONDeserialize  to database ,

Hope this will work,

Komal

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.