Skip to content

Commit 1ab8606

Browse files
authored
BTS-1715 | PUT /_admin/license takes a JSON string (#380)
* PUT /_admin/license takes a JSON string Add 501 error code and example (values) * Adjust upgrading description
1 parent c9e77a7 commit 1ab8606

File tree

3 files changed

+429
-48
lines changed

3 files changed

+429
-48
lines changed

site/content/3.10/develop/http-api/administration.md

Lines changed: 143 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -758,16 +758,14 @@ paths:
758758
Can be called on single servers, Coordinators, and DB-Servers.
759759
responses:
760760
'200':
761-
description: ''
761+
description: |
762+
Returns the license information.
762763
content:
763764
application/json:
764765
schema:
765766
type: object
766767
required:
767-
- features
768768
- license
769-
- version
770-
- status
771769
properties:
772770
features:
773771
description: |
@@ -781,14 +779,23 @@ paths:
781779
The `expires` key lists the expiry date as Unix timestamp (seconds since
782780
January 1st, 1970 UTC).
783781
type: number
782+
example: 1683173040
784783
license:
785784
description: |
786-
The encrypted license key in Base64 encoding.
785+
The encrypted license key in Base64 encoding, or `"none"`
786+
in the Community Edition.
787+
type: string
788+
example: V0h/W...wEDw==
789+
hash:
790+
description: |
791+
The hash value of the license.
787792
type: string
793+
example: 982db5...44f3
788794
version:
789795
description: |
790796
The license version number.
791797
type: number
798+
example: 1
792799
status:
793800
description: |
794801
The `status` key allows you to confirm the state of the installed license on a
@@ -801,6 +808,12 @@ paths:
801808
- `read-only`: The license is expired over 2 weeks. The instance is now
802809
restricted to read-only mode.
803810
type: string
811+
example: good
812+
upgrading:
813+
description: |
814+
Whether the server is performing a database upgrade.
815+
type: boolean
816+
example: false
804817
tags:
805818
- Administration
806819
```
@@ -841,29 +854,143 @@ paths:
841854
Set to `true` to change the license even if it expires sooner than the current one.
842855
schema:
843856
type: boolean
857+
default: false
844858
requestBody:
845859
content:
846860
application/json:
847861
schema:
848-
type: object
849-
required:
850-
- license
851-
properties:
852-
license:
853-
description: |
854-
The request body has to contain the Base64-encoded string wrapped in double quotes.
855-
type: string
862+
description: |
863+
The request body has to contain the Base64-encoded string wrapped in double quotes.
864+
type: string
865+
example: eyJncmFudCI6...(Base64-encoded license string)...
856866
responses:
857-
'400':
858-
description: |
859-
If the license expires earlier than the previously installed one.
860867
'201':
861868
description: |
862869
License successfully deployed.
870+
content:
871+
application/json:
872+
schema:
873+
type: object
874+
required:
875+
- result
876+
properties:
877+
result:
878+
type: object
879+
required:
880+
- error
881+
- code
882+
properties:
883+
error:
884+
description: |
885+
A flag indicating that no error occurred.
886+
type: boolean
887+
example: false
888+
code:
889+
description: |
890+
The HTTP status code.
891+
type: integer
892+
example: 201
893+
'400':
894+
description: |
895+
If the license expires earlier than the previously installed one,
896+
or if the supplied license string is invalid.
897+
content:
898+
application/json:
899+
schema:
900+
type: object
901+
required:
902+
- error
903+
- code
904+
- errorNum
905+
- errorMessage
906+
properties:
907+
error:
908+
description: |
909+
A flag indicating that an error occurred.
910+
type: boolean
911+
example: true
912+
code:
913+
description: |
914+
The HTTP status code.
915+
type: integer
916+
example: 400
917+
errorNum:
918+
description: |
919+
The ArangoDB error number.
920+
type: integer
921+
errorMessage:
922+
description: |
923+
A descriptive error message.
924+
type: string
925+
'501':
926+
description: |
927+
If you try to apply a license in the Community Edition.
928+
content:
929+
application/json:
930+
schema:
931+
type: object
932+
required:
933+
- error
934+
- code
935+
- errorNum
936+
- errorMessage
937+
properties:
938+
error:
939+
description: |
940+
A flag indicating that an error occurred.
941+
type: boolean
942+
example: true
943+
code:
944+
description: |
945+
The HTTP status code.
946+
type: integer
947+
example: 501
948+
errorNum:
949+
description: |
950+
The ArangoDB error number.
951+
type: integer
952+
errorMessage:
953+
description: |
954+
A descriptive error message.
955+
type: string
863956
tags:
864957
- Administration
865958
```
866959

960+
**Examples**
961+
962+
{{< comment >}}
963+
Example not generated because it would require a valid license to demonstrate the API.
964+
{{< /comment >}}
965+
966+
```bash
967+
curl --header 'accept: application/json' --dump - --data '"eyJncmFudCI6...(Base64-encoded license string)..."' -X PUT http://localhost:8529/_admin/license
968+
```
969+
970+
{{< expand title="Show output" >}}
971+
```bash
972+
HTTP/1.1 201 Created
973+
content-type: application/json
974+
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0, s-maxage=0
975+
connection: Keep-Alive
976+
content-length: 37
977+
content-security-policy: frame-ancestors 'self'; form-action 'self';
978+
expires: 0
979+
pragma: no-cache
980+
server: ArangoDB
981+
strict-transport-security: max-age=31536000 ; includeSubDomains
982+
x-arango-queue-time-seconds: 0.000000
983+
x-content-type-options: nosniff
984+
985+
{
986+
"result": {
987+
"error": false,
988+
"code": 201
989+
}
990+
}
991+
```
992+
{{< /expand >}}
993+
867994
## Shutdown
868995

869996
### Start the shutdown sequence

0 commit comments

Comments
 (0)