Authentication
To use the Wego API you will need an access token
Getting access token is easy. Send a request to:
curl https://affiliate-api.wego.com/apps/oauth/token \
-H "Content-Type: application/json" \
-H "X-Wego-Version: 1" \
-d '{
"grant_type": "client_credentials", \
"client_id": "<your client ID>", \
"scope": "affiliate" \
}'
This will return a response in the form:
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ...",
"token_type": "bearer",
"expires_in": 43200,
"created_at": 1645521170,
"scope": "affiliates"
}
Call API
Extract the access_token
from the previous call and send it with the API
request as an authorization header:
curl https://affiliate-api.wego.com/api_name/api_action/ \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc..." \
-d '{..data..}'
Rate limit info can be found in the response headers X-RateLimit-Limit
,
X-RateLimit-Remaining
and X-RateLimit-Reset
. The X-RateLimit-Limit
is your
max number of requess you can make per minute. X-RateLimit-Remaining
is how
many requests you have left. X-RateLimit-Reset
is how many seconds left until
your rate limit will reset. It's best to keep track of these numbers to avoid
your application failing.