API Request Headers

API Headers are available for:

  1. Pagination of choices and macro results in an API call.

    The headers are X-range and Range, with the starting value as 0. These override and can be used instead of the skip and limit API parameters.

    For example, the following examples return the same results:

    GET /api/tool/Macro/?method=evaluate
         &hierarchy=[hierarchy]
         &input={{fn.lines}}
         &skip=0
         &limit=6
    
    
    
    GET /api/tool/Macro/?method=evaluate
         &hierarchy=[hierarchy]
         &input={{fn.lines}}
    
         Request headers:
    
         X-Range: items=0-5
         Range: items=0-5
    

    If the request is items=0-199 (for 200 items) and there are more results, the response will show:

    Content-Range:items 0-199/999999999
    

    Since it is undetermined how many items there are, the value 999999999 represents the total.

    In this example, we have a total of 298 items. if a subsequent request is for the next 200 items (200-399), this includes the total. The response will then also show the total number of items (298) returned by the macro:

    Content-Range:items 200-399/298
    
  2. Backward compatibility. The X-Version header is available to take an API version as value.

    For example:

    GET /api/data/Countries/?hierarchy=[hierarchy]
        &schema=true
        &format=json
    
        Request headers
        X-Version: 10.1.2
    

    Refer to the topics on API backwards compatibility.