Hello All,
how can I connect to api endpoint and fetch data from API and copy data in existing database table.
Follow these steps:
- Use the HTTP Request Activity: To connect to the API endpoint and fetch the data.
- Deserialize the JSON Response: Convert the JSON response into a format that UiPath can manipulate, typically a JObject or JArray.
- Add Data to the Existing DataTable: Loop through the deserialized data and add it to your existing DataTable.
Thanks,
Ashok
Api request can be done throughhttp request
And convert data to datatable can be done by deserialize activity
Both are under webapi package
For connecting to DB you can use DB related activities and use bulk insert or insert based on the support of your data provider
Cheers
You have to create a table such as this, I have given the data type for the same
| Refrance Code |API Call time | API Statu Code | API Respone | Status | etc…
|Nvarchar (MAX)| Current Time | NVARCHAR(100)| NVARCHAR (MAX) | Bit(1) | etc…
1 Call to API
2 Chack the Code response [300,200, etc]
3.1 Option 1: if you want to store the data then Deserialize the object to string
3.2.1 Option 2:if you have to store the data to specific columns then you need to get the data from the object
3.2.2 convert this data to the data table
4 Save the data to the database one by one after the success, Use UiPath packages for connecting to your database based on the base Provider [MY SQL/MS SQL/ Oracle / Or any other database]
Do not use the data table for storing the data table after each API call because you can lose the data if the bot stops due to an unknown exception.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.