Hi devs,

We have come across the below format for requests and responses for
resource listing in Identity Server REST APIs.

The below parameters will be used in the resource listing requests.

   - limit - Items requested for the page. If the parameter is omitted we
   will be using 30 as the default value and max limit allowed would be 100 if
   there is no limitation in the backend implementation. In that case, the
   maximum value will be advertised in the API definition.
   - offset - 0 based index to get the results starting from element number
   offset + 1.
   - sortOrder - Whether to sort the results in ascending or descending
   order. Supported values are ASC and DESC. If the backend API does not
   support either of these values, we might be returning an error.
   - sortBy - Attribute to use for sorting.
   - attributes - Attributes to be included in the responses.

If limit/offset values are invalid we will be using default values.

The below parameters will be used in the responses.

   - totalResults - Number of results that match the listing operation.
   - startIndex - Index of the first element of the page, which will be
   equal to offset + 1.
   - count - Number of elements in the page.
   - links - Links that can be used to navigate between pages. The links
   section will contain the below format.

"links": [

    {

        "href": "resource?offset=50&limit=10",

        "rel": "next",

    },  {

        "href": "resource?offset=30&limit=10",

        "rel": "previous",

    },  {

        "href": "resource?offset=0&limit=10",

        "rel": "first",

    },  {

        "href": "resource?offset=100&limit=10",

        "rel": "last",

    }

]


Links will be included with the below rules.

   - If this is the first page, it will have “next” and “last” links only.
   - If this is the last page, it will have “previous” and “first” links
   only.
   - If the existing backend does not support to get the required links
   (and it's hard to implement it), we might skip adding (some of) these links.

Please let us know your thoughts regarding this approach.

Regards,
-- 
*Maduranga Siriwardena* | Associated Technical Lead | WSO2 Inc.
(m) +94718990591 | madura...@wso2.com

<http://wso2.com/signature>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to