Get an access token
curl --request POST \
--url https://web.edcontrols.com/api/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=password \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data username=jsmith@example.com \
--data 'password=<string>' \
--data 'scope=read write'import requests
url = "https://web.edcontrols.com/api/v1/oauth/token"
payload = {
"grant_type": "password",
"client_id": "<string>",
"client_secret": "<string>",
"username": "jsmith@example.com",
"password": "<string>",
"scope": "read write"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'password',
client_id: '<string>',
client_secret: '<string>',
username: 'jsmith@example.com',
password: '<string>',
scope: 'read write'
})
};
fetch('https://web.edcontrols.com/api/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://web.edcontrols.com/api/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://web.edcontrols.com/api/v1/oauth/token"
payload := strings.NewReader("grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://web.edcontrols.com/api/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "bearer",
"scope": "<string>"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Authentication
Get an access token
Exchange your client credentials plus the credentials of an Ed Controls user (we recommend a dedicated service account) for a Bearer token. Tokens are valid for approximately 24 hours.
POST
/
api
/
v1
/
oauth
/
token
Get an access token
curl --request POST \
--url https://web.edcontrols.com/api/v1/oauth/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=password \
--data 'client_id=<string>' \
--data 'client_secret=<string>' \
--data username=jsmith@example.com \
--data 'password=<string>' \
--data 'scope=read write'import requests
url = "https://web.edcontrols.com/api/v1/oauth/token"
payload = {
"grant_type": "password",
"client_id": "<string>",
"client_secret": "<string>",
"username": "jsmith@example.com",
"password": "<string>",
"scope": "read write"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'password',
client_id: '<string>',
client_secret: '<string>',
username: 'jsmith@example.com',
password: '<string>',
scope: 'read write'
})
};
fetch('https://web.edcontrols.com/api/v1/oauth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://web.edcontrols.com/api/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://web.edcontrols.com/api/v1/oauth/token"
payload := strings.NewReader("grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://web.edcontrols.com/api/v1/oauth/token")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "grant_type=password&client_id=%3Cstring%3E&client_secret=%3Cstring%3E&username=jsmith%40example.com&password=%3Cstring%3E&scope=read%20write"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "bearer",
"scope": "<string>"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Body
application/x-www-form-urlencoded
