cURL
curl --request POST \
--url https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2 \
--header 'Content-Type: application/json' \
--data '
{
"username": "demo_user",
"password": "demo_pass",
"grant_type": "password"
}
'import requests
url = "https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2"
payload = {
"username": "demo_user",
"password": "demo_pass",
"grant_type": "password"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username: 'demo_user', password: 'demo_pass', grant_type: 'password'})
};
fetch('https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2', 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://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'username' => 'demo_user',
'password' => 'demo_pass',
'grant_type' => 'password'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2"
payload := strings.NewReader("{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "93019854-6B88-4997-9179-C1C50E7D2E9D",
"expires_in": 3600,
"refresh_token": "2495C12E-AFFA-40AD-8B91-61D7CEE3D5DC",
"refresh_expires_in": 18000,
"fuse_client_id_seq": null
}Authentication API
Authentication
Authenticate the user with the system and obtain the access_token. Request and Response Content-Type would be JSON.
POST
/
index.php
/
api
/
oauth2
cURL
curl --request POST \
--url https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2 \
--header 'Content-Type: application/json' \
--data '
{
"username": "demo_user",
"password": "demo_pass",
"grant_type": "password"
}
'import requests
url = "https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2"
payload = {
"username": "demo_user",
"password": "demo_pass",
"grant_type": "password"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username: 'demo_user', password: 'demo_pass', grant_type: 'password'})
};
fetch('https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2', 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://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'username' => 'demo_user',
'password' => 'demo_pass',
'grant_type' => 'password'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2"
payload := strings.NewReader("{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2")
.header("Content-Type", "application/json")
.body("{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://marketplace-as-a-service.herokuapp.com/index.php/api/oauth2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"username\": \"demo_user\",\n \"password\": \"demo_pass\",\n \"grant_type\": \"password\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "93019854-6B88-4997-9179-C1C50E7D2E9D",
"expires_in": 3600,
"refresh_token": "2495C12E-AFFA-40AD-8B91-61D7CEE3D5DC",
"refresh_expires_in": 18000,
"fuse_client_id_seq": null
}Body
application/json
Provide username, password, and grant_type (password).
Response
Successful response
The access token to authenticate requests.
Time in seconds until the access token expires.
The refresh token used to obtain a new access token.
Time in seconds until the refresh token expires.
Client ID sequence, can be null.

