A REST linked service
A linked service with the base URL, a dataset with the relative URL, and a first copy of one page to see what comes back.
Many sources only offer a REST API: a CRM, a ticket system, a public data service. Azure Data Factory reads them with the REST connector, which sends the requests, follows the pages and writes the JSON wherever a copy activity can write. This course uses JSONPlaceholder, a free test API with 100 sample posts, so nothing needs a key.
A linked service for the API
In Data Factory Studio open Manage > Linked services > + New, search for REST and fill in:
Name ls_jsonplaceholder
Base URL https://jsonplaceholder.typicode.com/
Authentication type AnonymousSelect Test connection. For a real API, pick its authentication here instead: Basic, a service principal, a managed identity, or a key sent as a header from the copy activity.
A dataset for one resource
The linked service holds the address of the API; the dataset holds the path of one resource. Create a REST dataset on ls_jsonplaceholder with:
Name ds_posts
Relative URL postsThe full request is the base URL plus the relative URL: https://jsonplaceholder.typicode.com/posts.
Look at what comes back
Before building a pipeline, read the response. In a browser or a terminal:
https://jsonplaceholder.typicode.com/posts?_page=1&_limit=10returns a list of ten objects (the text is shortened here):
[
{ "userId": 1, "id": 1, "title": "sunt aut facere", "body": "quia et suscipit" },
{ "userId": 1, "id": 2, "title": "qui est esse", "body": "est rerum tempore" }
]Three facts decide the rest of the course: the rows are a list at the top level, each row has four fields, and the API pages with _page and _limit. Page 11 of ten rows comes back as an empty list [], because there are 100 posts.
Most real APIs answer in one of three ways: a page number like this one, an offset (offset=0, offset=1000), or a link to the next page inside the response. The next lesson handles each of them.
A first copy
Create a pipeline pl_posts, drag in a Copy data activity and set its Source to ds_posts, with Request method GET. For a quick look, set the Sink to a JSON dataset on your lake and press Debug. The output shows rows read and rows written: 100, because without paging parameters this API returns everything at once.
Many APIs do not. They return the first page and stop, and a copy without pagination rules would quietly land only that first page.