12 API Record Credentials
Lukas Metzger edited this page 2018-04-02 13:29:32 +02:00

Record credentials

Get list of credentials

GET /records/{id}/credentials?page=5&pagesize=10

parameter explanation
page The page of the results to return, if ommited returns page 1
pagesize How many items should be on each page, if ommited page size is infinite therefore all results are returned

Response

code result
200 Everything was successful
403 User has no permissions for the given record
{
  "paging": {
    "page": 5,
    "total": 20,
    "pagesize": 10
  },
  "results": [
    {
      "id": 1,
      "description": "This is for what that credential is",
      "type": "key|password"
    }
  ]
}

Create new credential

POST /records/{id}/credentials

Body

{
    "description": "This is for what that credential is",
    "type": "key|password",
    "key?": "key if type=key",
    "password?": "password if type=password"
}

Response

code result
201 Everything was successful, domain has been created
400 Either type is not valid, or key is not a valid public key
404 The given record was not found.
422 One of the required fields is missing
{
    "id": 1,
    "description": "This is for what that credential is",
    "type": "key|password",
    "key?": "key if type=key"
}

Delete credential

DELETE /records/{id}/credentials/{id}

Response

code result
204 Everything was successful, the answer body is therefore empty
403 User has no permission for the record
404 The given record id does not exist

Get single credential

GET /records/{id}/credentials/{id}

Response

code result
200 Call was successful
404 The given record id does not exist
{
    "id": 1,
    "description": "This is for what that credential is",
    "type": "key|password",
    "key?": "key if type=key"
}

Update credential

PUT /records/{id}/credentials/{id}

If type is given the corosponding key or password attribute must be set.

Body

{
    "description": "This is for what that credential is",
    "type": "key|password",
    "key?": "key if type=key",
    "password?": "password if type=password"
}

Response

code result
204 Everything was successful, the answer body is therefore empty
400 Either type is not valid, or key is not a valid public key
403 User has no permissions for this record
404 The given credential id does not exist
422 One of the required fields is missing, or key is invalid