REST API  16
REST API for Luna Network HSMs
Formatting

The REST API framework provides formatting options for requests and their responses to suit the needs of your application.

Responses

To format a response, include your formatting options in the query, as described below.

Limit

This is a filter that limits the number of elements in an array. If, for example, the server would normally return 100 elements (0-99), setting a limit of 20 would return elements 0-19 only. /verbatim https://LUNAIPADDRESS:PORT/api/hsms/{hsmid}/partitions?limit=20 /endverbatim When limit is used with offset it can generate a link header with a link to the "next" page. The link header will not be created if there are no more pages.

Offset

This filter offsets the results of an array. If, for example, the server would normally return 100 elements (0-99), an offset of 20 would return elements 20-99. /verbatim api/hsms/1234/partitions?offset=20 /endverbatim

Notes:

  • Any filter that operates on arrays will modify the first array in an object. For example, if you expand partitions when fetching an HSM, the partitions are formatted.
  • Multiple filters can be combined for desired effect. For example:
    api/hsms/1234/partitions?limit=2&offset=2
    
    This format will return elements 2,3 and skip 0 and 1.

Requests

The REST API framework provides some options for formatting requests.

URL encoding

URLs can only be sent using the ASCII character-set. Since the REST API framework allows you to use some non-ASCII characters in URLs, these characters must be encoded by the REST client and decoded by the server. Currently, the REST API framework supports the ASCII characters from 20 (space) to 126 (tilde).

GET
https://LUNAIPADDRESS:PORTapi/lunasa/hsms/1234/partitions/20160901/stc/clients/client%20%luna

The example above encodes the client name "client luna" to "client%20luna" in URL.