Authorized API access - SCOAP3/scoap3-next GitHub Wiki
Authorized API access
When you are a SCOAP3 partner it is much easier to harvest the API. When you register as a partner to Tools & unlimited API you will be able to generate a token which will allow you to run your API queries as logged-in user. The benefit of this is unlimited* number of records returned by API in one query. Without the token, number of records returned by single query is limited to 10 what forces the user to "scroll through the result pages", generate links to the next page, watchout for the errors and server ban for too many requests.
*In practice the number of records is limited to ~10000 due to performance reasons.
Token generation
- Login on the login page.
- Go to user profile page by following this link or click on the link in the top right corner of the repository website.
- Select Applications from the menu on the left side of the website.
- Click on the + New Token button in the Personal access tokens panel.
- In the form please put the name of the new key and press Save.
- The newly generated access token will be displayed at the top of the page.
- [IMPORTANT] Please save it securely, there is no way to retrieve this access token. If you lose it, you will need to create a new one.
API token usage
There are two ways of using the unlimited API. One either has to be logged in using the login form or provide the access token in all queries. Let's take an example query like:
https://repo.scoap3.org/api/records/?p=higgs
To authenticate and have access to the unlimited number of results in one query you need to add additional parameter to this query: access_token
. New query with your token will be similar to this one:
https://repo.scoap3.org/api/records/?p=higgs&access\_token=abc123def456ghi789jkl012mno345pqr678stuwxyz
More information about the API queries is available here.
Pro Tip: you might want to add a size
parameter to your query to define how many records you want per query.