API Authorization¶
To connect to BidSwitch using one of its APIs, use the following steps.
Create an API user in your myBidSwitch UI account.
Using this user’s credentials, get your API token by making a
POST
request to the BidSwitch authorization endpoint.Pass this token in your request header
Authorization:Bearer ${TOKEN}
Creating an API User¶
To create a user profile that can receive API Tokens, use the following steps. Once created you can get get a permanent token or request short lived temporary tokens:
From the BidSwitch UI, select
.From the User Role dropdown menu, select API Account.
Permanent Auth Tokens¶
To get a permanent auth token for your integration, use the following steps.
Log into the BidSwitch single sign-on service
Select
Set the scope to
api.bidswitch.com
, and CreateSave the generated token for use with your API requests, this token must be passed in the request header.
Temporary Auth Tokens¶
To get a temporary auth token for your integration, use the following steps. Make an
HTTP POST
request to the following URL. The response will contain your access token
and its expiration time. You can use this token to perform API requests until the token
expires.
Endpoint Info |
Description |
---|---|
endpoint |
|
Method |
|
headers |
Content-Type and Accept
|
username |
(Required) Your UI username |
password |
(Required) Your UI password |
scope |
(Required) The service to which your user token should grant you access,
e.g. |
curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -H 'accept: application/json' -d 'grant_type=password&username=${username}&password=${password}&scope=service_id=api.bidswitch.com' 'https://uauth.iponweb.com/oauth2/token/'
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import requests
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"accept": "application/json",
}
payload = {
"grant_type": "password",
"username": login, # Your UI Login
"password": password, # Your UI Password
"scope": "service_id=api.bidswitch.com",
}
token_post = requests.post(
"https://uauth.iponweb.com/oauth2/token/", params=payload, headers=headers
)
response_json = token_post.json()
token = response_json["access_token"]
print(token)
{
"token_type": "Bearer",
"scope": "api.bidswitch.com",
"access_token": "<access_token>",
"expires_in": 3600,
"last_chars": "<last chars of auth token>"
}