How do i get data from external API into cosmos db?

NickKhoo-7526 31 Reputation points
2023-10-31T05:11:41.48+00:00

Hi,

I am exploring cosmos db as a data to store data that will be collected from public APIs from the internet. I am new to this technology. How do I get those data into cosmos db?

Appreciate it if anyone can provide some guidance.

Thanks

Nk

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,693 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sajeetharan 2,261 Reputation points Microsoft Employee
    2023-10-31T13:25:59.1666667+00:00

    If I understand your question right, you have a data from an external API and want to write the data to Azure Cosmos DB? You can use SDK/Drivers to connect to the Cosmos DB account depending on the API type and use the language of your choice to write code that fetches data from the external API. After fetching data from the external API, parse and transform it as needed to match the data model you've defined in your Cosmos DB collection. Rest of the logic remains the same as how you would write/insert data to Cosmos DB.


  2. Rumen Krastev 0 Reputation points Microsoft Employee
    2023-11-09T17:07:00.8733333+00:00

    Concretely, to add what Sajeetharan says, you're going to need a trigger (could be scheduled too), which upon event/time get the data from public API and save it to Cosmos. Here're some helpers:

    If you prefer videos, here's one: https://www.youtube.com/watch?v=oIwDgJPmVCg

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.