Update an Existing Project

Modify app details like name, description, token expiry & refresh, and key rotation period.

Endpoint

PATCH /root/{app_id}

Headers

Name Type Required Description
Authorization string Yes The root-key of the project.

Example Request

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();

Request Fields

Field Type Required Description
name string Yes The name of the application.
description string No A brief description of the application.
token_expiry int Yes The time (in seconds) after an issued token expires.
token_notbefore int Yes The time (in seconds) a token becomes valid after issuance.
refresh_expiry int Yes The expiration time (in seconds) for refresh tokens.
refresh_notbefore int Yes The time (in seconds) before a refresh token becomes valid after issuance.
rotation_period int Yes The period (in seconds) after which cryptographic keys should be rotated.

Example Success Response

{
"status": "ok"
}

Response Fields

Field Type Description
status string ok - API executed successfully.

Responses

Status Code Description
200 Ok Success
400 Bad Request Mostly when the form validation fails. The error will be returned as a response.
403 Access Denied When the provided root key in Authorization header is invalid.
500 Internal Server Error Mostly because of the database error. Check the log for root cause details.