RESTful API Pagination

You can select and limit the data that is provided by the RESTful API by using the same dataClasses endpoint. For example, if you want to get the 3rd item only, you can specify the limit and offset as follows:

 curl -k -s -v "https://lynx.tuc.stglabs.ibm.com/api/v2/dataClasses?limit=1&offset=2" -H "Authorization: Bearer xxxxx"
Note: The provided curl command syntax may not work under Windows environment, it depends on the application to run the curl command. You may need to adjust the command syntax if it does not work.

Sample response:

[
  {
    "lwormRetentionOptions": {
      "retentionType": "FIXED",
      "fixedDuration": 1,
      "applicationManagedDuration": null,
      "applyFixedDurationForFirstHDR1NoDate": null,
      "applyFixedDurationOnReturnToScratch": "no",
      "applyApplicationManagedDateForSubsequentHDR1": null,
      "honorAllSubsequentHDR1s": null,
      "noFirstHDR1TreatAsNoDate": null,
      "honorReturnToScratch": "no",
      "applyFixedDurationForSubsequentHDR1NoDate": null,
      "applyFixedDurationForNoSubsequentHDR1": null
    },
    "name": "ABC456",
    "counterHandling": "wrapSupported",
    "description": "",
    "compression": "ZSTD",
    "logicalWorm": "yes",
    "virtualVolumeSize": 0
  }
]
Note: The offset starts from 0 (that is, the 1st entry is offset=0).

Both limit and offset always need to be used together. Also, you can use them with sort:

 curl -k -s -v "https://lynx.tuc.stglabs.ibm.com/api/v2/dataClasses?limit=2&offset=2&sort=virtualVolumeSize" -H "Authorization: Bearer xxxxx"

Sample response:

[
  {
    "lwormRetentionOptions": {
      "retentionType": "HDR1",
      "fixedDuration": 99,
      "applicationManagedDuration": 1,
      "applyFixedDurationForFirstHDR1NoDate": "yes",
      "applyFixedDurationOnReturnToScratch": "yes",
      "applyApplicationManagedDateForSubsequentHDR1": "yes",
      "honorAllSubsequentHDR1s": "yes",
      "noFirstHDR1TreatAsNoDate": "yes",
      "honorReturnToScratch": "yes",
      "applyFixedDurationForSubsequentHDR1NoDate": "yes",
      "applyFixedDurationForNoSubsequentHDR1": "yes"
    },
    "name": "DC95474",
    "counterHandling": "wrapSupported",
    "description": "",
    "compression": "ZSTD",
    "logicalWorm": "yes",
    "virtualVolumeSize": 0
  },
  {
    "lwormRetentionOptions": {
      "retentionType": "HDR1",
      "fixedDuration": 0,
      "applicationManagedDuration": 31,
      "applyFixedDurationForFirstHDR1NoDate": null,
      "applyFixedDurationOnReturnToScratch": null,
      "applyApplicationManagedDateForSubsequentHDR1": "yes",
      "honorAllSubsequentHDR1s": "yes",
      "noFirstHDR1TreatAsNoDate": null,
      "honorReturnToScratch": "no",
      "applyFixedDurationForSubsequentHDR1NoDate": null,
      "applyFixedDurationForNoSubsequentHDR1": null
    },
    "name": "DC954871",
    "counterHandling": "wrapSupported",
    "description": "Robot Framework POST Test Of Valid Data",
    "compression": "ZSTD",
    "logicalWorm": "yes",
    "virtualVolumeSize": 0
  }
]

Also, you can use limit and offset with the normal query such as:

 curl -k -s -v "https://lynx.tuc.stglabs.ibm.com/api/v2/dataClasses?limit=2&offset=2&sort=virtualVolumeSize&compression=ZSTD" -H "Authorization: Bearer xxxxx"

Sample response:

[
  {
    "lwormRetentionOptions": null,
    "name": "DCFAIL",
    "counterHandling": "wrapSupported",
    "description": "hmm",
    "compression": "ZSTD",
    "logicalWorm": "no",
    "virtualVolumeSize": 0
  }
]
Note:

-If offset is specified more than the actual resources, HTTP RC=400 (bad request) is returned.

-If a limit is specified more than the actual resources, all resources are returned.