REST API  4.0.0
REST API for SafeNet Network HSMs
Formatting

Formatting Responses

The REST API framework allows the user to format the response of any request. To format any response the user must include their formatting options in the query, see below for available options.

Limit

This is a filter that will limit the number of elements in an array. If for example the server would normaly return 100 elements(0-99) a limit of 20 would return elements 0-19.

e.g. api/hsms/1234/partitions?limit=20

When limit is used with offset it can generate a link header with a link to the "next" page. The link header will not exist is there are no more pages.

Offset

This filter will offset the results of an array. If for example the server would normaly return 100 elements(0-99) a offset of 20 would return elements 20 - 99.

e.g. api/hsms/1234/partitions?offset=20

When limit is used with offset it can generate a link header with a link to the "next" page. The link header will not exist is there are no more pages.

Notes

Any filter that opperates on arrays will modify the first array in an object. For example: if a user expands partitions when fetching an HSM the partitions would be formated not hsm.

Multiple filters can be combined for desired effect. e.g. api/hsms/1234/partitions?limit=2&offset=2 (will get element 2,3 and skip 0 and 1)

Formatting Requests

The REST API framework allows the user to format requests, see below for methods available.

URL encoding

URLs can only be sent using the ASCII character-set.

Since the REST API framework allows the user to use some characters which are outside the ASCII characters-set in URLs. URLs have to be encoded by the REST client and decoded by the server.

Currently, the REST API framework supports the ASCII characters from 32 (space) to 126 (tilde).

e.g. GET api/lunasa/hsms/1234/partitions/20160901/stc/clients/client%20luna

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