curl --request POST \
--url http://{host}:{port}/{contextPath}/authorization/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": 0,
"permissions": [
"CREATE",
"READ"
],
"userId": "*",
"groupId": null,
"resourceType": 1,
"resourceId": "*"
}
'import requests
url = "http://{host}:{port}/{contextPath}/authorization/create"
payload = {
"type": 0,
"permissions": ["CREATE", "READ"],
"userId": "*",
"groupId": None,
"resourceType": 1,
"resourceId": "*"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 0,
permissions: ['CREATE', 'READ'],
userId: '*',
groupId: null,
resourceType: 1,
resourceId: '*'
})
};
fetch('http://{host}:{port}/{contextPath}/authorization/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{contextPath}/authorization/create",
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([
'type' => 0,
'permissions' => [
'CREATE',
'READ'
],
'userId' => '*',
'groupId' => null,
'resourceType' => 1,
'resourceId' => '*'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "http://{host}:{port}/{contextPath}/authorization/create"
payload := strings.NewReader("{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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("http://{host}:{port}/{contextPath}/authorization/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{contextPath}/authorization/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}"
response = http.request(request)
puts response.read_body{
"id": "anAuthorizationId",
"type": 0,
"permissions": [
"CREATE",
"READ"
],
"userId": "*",
"groupId": null,
"resourceType": 1,
"resourceId": "*",
"removalTime": "2018-02-10T14:33:19.000+0200",
"rootProcessInstanceId": "f8259e5d-ab9d-11e8-8449-e4a7a094a9d6",
"links": [
{
"method": "GET",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "self"
},
{
"method": "PUT",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "update"
},
{
"method": "DELETE",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "delete"
}
]
}创建记录
创建一个授权记录
curl --request POST \
--url http://{host}:{port}/{contextPath}/authorization/create \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": 0,
"permissions": [
"CREATE",
"READ"
],
"userId": "*",
"groupId": null,
"resourceType": 1,
"resourceId": "*"
}
'import requests
url = "http://{host}:{port}/{contextPath}/authorization/create"
payload = {
"type": 0,
"permissions": ["CREATE", "READ"],
"userId": "*",
"groupId": None,
"resourceType": 1,
"resourceId": "*"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 0,
permissions: ['CREATE', 'READ'],
userId: '*',
groupId: null,
resourceType: 1,
resourceId: '*'
})
};
fetch('http://{host}:{port}/{contextPath}/authorization/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://{host}:{port}/{contextPath}/authorization/create",
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([
'type' => 0,
'permissions' => [
'CREATE',
'READ'
],
'userId' => '*',
'groupId' => null,
'resourceType' => 1,
'resourceId' => '*'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"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 := "http://{host}:{port}/{contextPath}/authorization/create"
payload := strings.NewReader("{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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("http://{host}:{port}/{contextPath}/authorization/create")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{host}:{port}/{contextPath}/authorization/create")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": 0,\n \"permissions\": [\n \"CREATE\",\n \"READ\"\n ],\n \"userId\": \"*\",\n \"groupId\": null,\n \"resourceType\": 1,\n \"resourceId\": \"*\"\n}"
response = http.request(request)
puts response.read_body{
"id": "anAuthorizationId",
"type": 0,
"permissions": [
"CREATE",
"READ"
],
"userId": "*",
"groupId": null,
"resourceType": 1,
"resourceId": "*",
"removalTime": "2018-02-10T14:33:19.000+0200",
"rootProcessInstanceId": "f8259e5d-ab9d-11e8-8449-e4a7a094a9d6",
"links": [
{
"method": "GET",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "self"
},
{
"method": "PUT",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "update"
},
{
"method": "DELETE",
"href\"": "http://localhost:8080/engine-rest/authorization/anAuthorizationId",
"rel": "delete"
}
]
}Authorizations
Body
The type of the authorization (0=global, 1=grant, 2=revoke). See the User Guide for more information about authorization types.
An integer representing the resource type. See the User Guide for a list of integer representations of resource types.
Response
Request successful.
The type of the authorization (0=global, 1=grant, 2=revoke). See the User Guide for more information about authorization types.
An integer representing the resource type. See the User Guide for a list of integer representations of resource types.
The removal time indicates the date a historic instance
authorization is cleaned up. A removal time can only be assigned to a historic
instance authorization. Can be null when not related to a historic instance
resource or when the removal time strategy is end and the root process instance
is not finished. Default format yyyy-MM-dd'T'HH:mm:ss.SSSZ.