Modify app details like name, description, token expiry & refresh, and key rotation period.
curl --request PATCH \
--url http://{{your-endpoint}}:{{your-port}}/root/{{app-id}} \
--header 'Authorization: {{root-key}}' \
--header 'content-type: application/json' \
--data '{
"name":"app_2",
"description":"updated description",
"token_expire": 3600,
"token_notbefore":0,
"refresh_expire": 10800,
"refresh_notbefore" : 3000,
"rotation_period": 7776000
}'
const request = require('request');
const options = {
method: 'PATCH',
url: 'http://{{your-endpoint}}:{{your-port}}/root/{{app-id}}',
headers: {Authorization: '{{root-key}}', 'content-type': 'application/json'},
body: {
name: 'app_2',
description: 'updated description',
token_expire: 3600,
token_notbefore: 0,
refresh_expire: 10800,
refresh_notbefore: 3000,
rotation_period: 7776000
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
import requests
url = "http://{{your-endpoint}}:{{your-port}}/root/{{app-id}}"
payload = {
"name": "app_2",
"description": "updated description",
"token_expire": 3600,
"token_notbefore": 0,
"refresh_expire": 10800,
"refresh_notbefore": 3000,
"rotation_period": 7776000
}
headers = {
"Authorization": "{{root-key}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'http://{{your-endpoint}}:{{your-port}}/root/{{app-id}}', [
'body' => '{
"name":"app_2",
"description":"updated description",
"token_expire": 3600,
"token_notbefore":0,
"refresh_expire": 10800,
"refresh_notbefore" : 3000,
"rotation_period": 7776000
}',
'headers' => [
'Authorization' => '{{root-key}}',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://{{your-endpoint}}:{{your-port}}/root/{{app-id}}"
payload := strings.NewReader("{\n \"name\":\"app_2\",\n \"description\":\"updated description\",\n \"token_expire\": 3600,\n \"token_notbefore\":0,\n \"refresh_expire\": 10800,\n \"refresh_notbefore\" : 3000,\n \"rotation_period\": 7776000\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "{{root-key}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "http://{{your-endpoint}}:{{your-port}}/root/{{app-id}}")
.setHeader("Authorization", "{{root-key}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\":\"app_2\",\n \"description\":\"updated description\",\n \"token_expire\": 3600,\n \"token_notbefore\":0,\n \"refresh_expire\": 10800,\n \"refresh_notbefore\" : 3000,\n \"rotation_period\": 7776000\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();