Pagination
Pagination is a technique used to manage and display large data sets by dividing them into smaller and manageable pages. It allows users or applications to navigate through data incrementally, preventing information overload.
Cursor Pagination
The Manufacturing Data Model API supports data retrieval through cursor-based pagination. It uses a unique identifier (the cursor) associated with each page to fetch the next set of results. This approach provides precise navigation through large data sets, ensuring efficient and responsive data retrieval.
Step 1 - Browse pages without a cursor
You can access the initial page of data by specifying a page limit without the need for a cursor. The cursor, encoded in the first response, aligns with your selected response limit. The cursor code makes it easier to navigate to the next page of results until there are no more results to display.
This activity demonstrates how to use the Manufacturing Data Model Explorer to fetch the initial page of property collections in a hub by setting a specific page limit:
- Enter the following query in the query pane.
Note: To limit the response to only five results, the pagination limit is set to five as:
pagination: {limit: 5}. If you do not set a page limit, the query will return responses based on the default page limit.Query
query propertyDefinitionCollectionsByHub($hubId: ID!) { propertyDefinitionCollectionsByHubId(hubId: $hubId, pagination: {limit: 5}) { pagination { pageSize cursor } results { id name propertyDefinitions { results { name } } } } }Show More - In the Query Variables Pane, enter the
hubIdto which the Property collection is mapped.Query Variables
{ "hubId": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2" } - Click Play. After clicking the “Play” button, the response will display a list of five property collections, including an initial cursor value of
"cursor": "MTB-MTA".Response
{ "data": { "propertyDefinitionCollectionsByHubId": { "pagination": { "pageSize": 5, "cursor": "MTB-MTA" }, "results": [ { "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35Qb3N0bWFuX1Rlc3RfQ29sbGVjdGlvbg", "name": "Postman_Test_Collection" }, { "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfNTIzOTU", "name": "prop_def_col_52395" }, { "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfMzI4ODA", "name": "prop_def_col_32880" }, { "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfODE5NDY", "name": "prop_def_col_81946" }, { "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfMzkzMTY", "name": "prop_def_col_39316" } ] } } }Show More
End of pagination
Upon receiving a response without a cursor to the next page of results, you can conclude that you have reached the end. Also, the cursor value is null at the end of the page. Therefore, you should anticipate a response like the followingat this stage.
Response
{ "data": { "propertyDefinitionCollectionsByHubId": { "pagination": { "pageSize": 0, "cursor": null }, "results": [] } } }Show More
Usage
The Manufacturing Data Model API supports pagination for the following fields.
| Usage | Used By | Description |
|---|---|---|
| Field Of | AssemblyRelations | Contains a list of assembly relations returned in response to a query. |
| Field Of | BasicItemVersions | Contains a list of basic item versions returned in response to a query. |
| Field Of | BOMRelations | Object that contains an array of BOM relations. |
| Field Of | ConfiguredDesignItemVersions | Contains a list of objects, where each object represents a version of a design item. |
| Field Of | designitemversions | Contains a list of objects, where each object represents a version of a design item. |
| Field Of | drawingitemversions | Contains a list of objects, where each object represents a version of a drawing item that contains 2D projections of a component. |
| Field Of | FolderMembers | Represents pagination and result of list of folder members. |
| Field Of | Folders | A list of Folders returned in response to a query. |
| Field Of | GroupMembers | Represents pagination and result of list of group members. |
| Field Of | Groups | Represents pagination and list of groups. |
| Field Of | HistoryChanges | Contains a list of History Changes returned in response to a query. |
| Field Of | HubMembers | Represents pagination and result of list of hub members. |
| Field Of | Hubs | Contains a list of hubs returned in response to a query. |
| Field Of | Items | Contains a list of items returned in response to a query. |
| Field Of | ItemVersions | Retrieves all versions of the specified item. |
| Field Of | ProjectMembers | Represents pagination and result of list of project members. |
| Field Of | Projects | Contains a list of projects returned in response to a query. |
| Field Of | Properties | Object representing list of Properties. |
| Field Of | PropertyDefinitionCollections | Contains a list of Property Definition Collections returned in response to a query. |
| Field Of | PropertyDefinitions | List of Property Definitions. |