Skip to content

License Server API

Furkan Senharputlu edited this page Apr 15, 2020 · 4 revisions

Table of Content

Generate license

Sample request

POST /admin/licenses HTTP/1.1
Host: localhost:4242
Content-Type: application/json
Authorization: admin123

{
   "type": "Trial",
   "claims": {
      "username": "Furkan",
      "address": "Istanbul, Turkey"
   },
   "active": true
}

Sample response

{
    "id": "5e6ec9ce571983fd0e468213",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.bnVsbA.BF4LHTey6WwVbYuKSP_kyfeB2-PZPEJYHmkdp_R92y4"
}

Verify license

Sample request

POST /license/verify HTTP/1.1
Host: localhost:4242
Content-Type: application/x-www-form-urlencoded
Authorization: admin123

token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.bnVsbA.BF4LHTey6WwVbYuKSP_kyfeB2-PZPEJYHmkdp_R92y4

Sample response

{
    "valid": true
}

Get license

Sample request

GET /admin/licenses/{id} HTTP/1.1
Host: localhost:4242
Authorization: admin123

Sample response

{
    "active": true,
    "claims": {
        "elma": "Istanbul, Turkey",
        "username": "Furkan"
    },
    "id": "5e9789150ca4cfc86de24afd",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbG1hIjoiSXN0YW5idWwsIFR1cmtleSIsInVzZXJuYW1lIjoiRnVya2FuIn0.nXkNVO4WDPo2n9VT8iuMlYnrGJwipG2O1m1zeAFt1yw",
    "type": "Trial"
}

Activate license

Sample request

PUT /admin/licenses/{id}/activate HTTP/1.1
Host: localhost:4242
Authorization: admin123

Sample response

{
    "message": "Activated"
}

Inactivate license

Sample request

PUT /admin/licenses/{id}/inactivate HTTP/1.1
Host: localhost:4242
Authorization: admin123

Sample response

{
    "message": "Inactivated"
}

Delete license

Sample request

DELETE /admin/licenses/{id}/delete HTTP/1.1
Host: localhost:4242
Authorization: admin123

Sample response

{
    "message": "License successfully deleted"
}
Clone this wiki locally