Add tokens to group
curl --request POST \
--url https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens"
payload = { "token_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({token_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']})
};
fetch('https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens', 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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens",
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([
'token_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens"
payload := strings.NewReader("{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "<string>",
"emsp_identity_id": "<string>",
"name": "<string>",
"token_count": 1,
"status_summary": {
"provisioned": 1,
"active": 1,
"suspended": 1,
"expired": 1,
"revoked": 1
},
"audit": {
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>"
},
"description": "<string>",
"network_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}Add tokens to group
Adds tokens to the group and returns the updated group. A token can be a member of any number of groups, so adding it here does not remove it from other groups. The members of a group cannot be listed yet.
Requires the emsp:tokens:write scope.
POST
/
emsp
/
v1
/
token-groups
/
{groupId}
/
tokens
Add tokens to group
curl --request POST \
--url https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"token_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}
'import requests
url = "https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens"
payload = { "token_ids": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({token_ids: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']})
};
fetch('https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens', 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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens",
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([
'token_ids' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens"
payload := strings.NewReader("{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.spirii.com/emsp/v1/token-groups/{groupId}/tokens")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"token_ids\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "<string>",
"emsp_identity_id": "<string>",
"name": "<string>",
"token_count": 1,
"status_summary": {
"provisioned": 1,
"active": 1,
"suspended": 1,
"expired": 1,
"revoked": 1
},
"audit": {
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>"
},
"description": "<string>",
"network_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}{
"message": "<string>"
}{
"type": "/errors/validation-failed",
"title": "Validation Failed",
"status": 422,
"detail": "<string>",
"error_code": "RESOURCE_NOT_FOUND",
"correlation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"retryable": true,
"retry_after_seconds": 2,
"errors": [
{
"field": "body.tokens[3].uid",
"code": "INVALID_ENUM",
"message": "<string>"
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
The token group group_id
Body
application/json
The id of each token to add
Required array length:
1 - 1000 elementsResponse
The updated group
Stable token group id
Owning tenant, set by the platform
The EMSP identity the group belongs to
Required string length:
1 - 64Required string length:
1 - 255Number of member tokens
Required range:
x >= 0Number of member tokens in each status. The counts add up to token_count
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Maximum string length:
1000Networks assigned to the group. Managed through the network assignment operations
Was this page helpful?