Open APIs

Expand all | Collapse all

Pagination Implementation for TMF API

  • 1.  Pagination Implementation for TMF API

    TM Forum Member
    Posted 24 days ago
    Hello All,
    We are implmenting Ticketing API and since many customers have huge number of tickets,  > 1000 in some cases. Call center client app needs all tickets to know the history.

    Checking TMF630 I found below example.

    REQUEST:

    GET api/customerManagement/customer?offset=20&limit=10

    Content-type: application/json

    RESPONSE:

    http 206 ---- (when partial resource is sent in response)

    Content-Type: application/json

    X-Total-Count :50

    Link: < https:server:port/customerManagement/customer?offset=20&limit=10>; rel="self",

    < https:server:port/ customerManagement / customer?offset=0&count=10>; rel="first", ---------------------------------> Is this a typo, or it is count and if yes, why? Should it be limit

    < https:server:port/ customerManagement / customer?offset=30&limit=10>;rel="next",

    <https:server:port/ customerManagement / customer?offset=10&limit=10>; rel="prev",

    < https:server:port/ customerManagement / customer?offset=40&limit=10>; rel="last"

    Question 1 -  Why link to first page/first set of records, we have offset and count parameter where as all other have offset and limit  ? Highlighted above

    Question 2:
    How would the links would look like when,

    Totoal record count =500,  offset=50 and limit=100

    GET ticket/?offset=50&limit=100

    link <http://api /?offset50&limit=100> rel=self [ticket id=50 to ticketid=149]
    <http://api /?offset0&count=100> rel=first [ticket id=0 to ticketid=99] -----------------------first , means 0-49 or 0-99 since limit is 100?
    <http://api /?offset150&limit=100> rel=next [ticket id=150 to ticketid=249]---- Should I have multiple next link ?
    <http://api /?offset0&limit=100> rel=prev [ticket id=0 to ticketid=99] ----------Here previous is with respect to self, which is coming same as first? is this correct.
    <http://api /?offset400&limit=100> rel=last [ticket id=400 to ticketid=499] -----

    Thanks in Advance.

    ------------------------------
    Chintan Acharya
    Tech Mahindra Limited
    ------------------------------


  • 2.  RE: Pagination Implementation for TMF API

    TM Forum Member
    Posted 23 days ago
    Hi Chintan,

    You are fully right identifying the unexpected use of 'count' in there. It should be 'limit' always and this needs to be there to be aligned there as per the guidelines (TMF630_REST_API_Design_Guidelines_Part_1_v4.0).

    Kind regards,

    ------------------------------
    Christophe MICHEL
    Amdocs Management Limited
    ------------------------------



  • 3.  RE: Pagination Implementation for TMF API

    TM Forum Member
    Posted 23 days ago
    Thanks Christophe.  So 1 question is cleared. :)

    ------------------------------
    Chintan Acharya
    Tech Mahindra Limited
    ------------------------------