Tokens

A token is a string that can be used in place of the RAO credentials when creating new digital signature requests.

Verb Endpoint Action
POST /token Create a new token
GET /token/{pk} Retrieve a token
GET /tokens List all available tokens
DELETE /token/{uid} Delete a token

Create a new token

Description

Generate a new token to hold the credentials of a Registration Authority Officer (RAO).

Endpoint

/api/v1/token

Method

POST

Parameters
Body Parameters
Parameter Description Mandatory
username The RAO's username Yes
password The RAO's password No
pin The RAO's pin No

When creating a token, take care to ensure that the RAO credentials introduced are correct.

Response

The response is a JSON object that contains the unique identifier (uid) assigned to the new token.


                    {
                        "status": "200 OK",
                        "details": "a44765ab8ca04e429a565f02d22179a0"
                    }
                

Note that a token can be created providing only a part of the RAO credentials (the password or the pin). If you do this, you will still need to provide the remaining credentials every time you use the token. For example, if the token was generated only with the username and password, the pin must still be specified as an additional parameter when using the token.

Errors

If the RAO username provided is invalid, the server will return an HTTP 500 status code and an error message like this:


                    {
                        "status": "500 Internal Server Error",
                        "details": "Error getting RAO's id. Make sure the credentials are correct"
                    }
                
Example

                    curl -H "Content-Type: application/json" -d '{"username": "2000279", "password": "12345678"}' -X POST https://oneshot.demo.uanataca.com/api/v1/token
                

                    {
                        "status": "200 OK",
                        "details": "05f76dbaf9fc4de594acff595db36e30"
                    }
                

Retrieve a token

Description

Retrieve the token with the given uid and list the credentials associated to it.

Endpoint

/api/v1/token/{uid}

Method

GET

Parameters
Path parameters
Parameter Description
uid The token uid
Response

The response returns information associated to the token:


                    {
                        "status": "200 OK",
                        "details": {
                            "username": "2000279",
                            "password": true,
                            "pin": true
                        }
                    }
                

Where "username" is the RAO account associated to that token. The values of the "password" and "pin" fields are true or false depending on whether that value was given or not during token generation. Missing (false) parameters must be passed as additional arguments whenever the token is used.

Errors

If the specified uid does not exist, a 404 error will be returned:


                    {
                        "status": "404 Not Found",
                        "details": "Token not found"
                    }
                
Example

                    curl -X GET https://oneshot.demo.uanataca.com/api/v1/token/05f76dbaf9fc4de594acff595db36e30
                

                    {
                        "status": "200 OK",
                        "details": {
                            "username": "2000279",
                            "password": true,
                            "pin": true
                        }
                    }
                

List available tokens

Description

Returns a list of all tokens available and their associated data.

Endpoint

/api/v1/tokens

Method

GET

Parameters

No parameters needed.

Response

Returns a list of tokens, specifying the associated RAO account for each and which credentials it holds:


                    {
                        "status": "200 OK",
                        "details": {
                            "d872c0eab9da42e69ec56c843d20bc6a": {
                                "username": "110003828",
                                "password": true,
                                "pin": true
                            },
                            "3ccc85545f844e898f733cf9d3451b23": {
                                "username": "9900123",
                                "password": false,
                                "pin": true
                            }
                        }
                    }
                
Example
curl -X GET https://oneshot.demo.uanataca.com/api/v1/tokens

                    {
                        "status": "200 OK",
                        "details": {
                            "3257f798458f4bf9af6a3d156ae32555": {
                                "username": "9900123",
                                "password": true,
                                "pin": true
                            },
                            "19bf49f9d7f64e9ab1a7611d3b0e803d": {
                                "username": "9001800",
                                "password": true,
                                "pin": true
                            },
                            "d872c0eab9da42e69ec56c843d20bc6a": {
                                "username": "110003828",
                                "password": true,
                                "pin": true
                            },
                            "3ccc85545f844e898f733cf9d3451b23": {
                                "username": "9900123",
                                "password": false,
                                "pin": true
                            }
                        }
                    }
                

Delete a token

Description

Delete token with the specified uid identifier

Endpoint

/api/v1/token/{uid}

Method

DELETE

Parameters
Path parameters
Parameter Description
uid The token uid
Response

A JSON object is returned in case of a successful deletion:


                    {
                        "status": "200 OK",
                        "details": "Token deleted successfully"
                    }
                
Errors

If the token is not found, an HTTP 404 error is returned instead:


                    {
                        "status": "404 Not Found",
                        "details": "Token not found"
                    }
                
Example
curl -X DELETE https://oneshot.demo.uanataca.com/api/v1/token/5cc819c1493f4852a949fd214ccf693f

                    {
                        "status": "200 OK",
                        "details": "Token deleted successfully"
                    }