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
hubId
to 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 | Componentversions | Contains a list of component versions returned in response to a query. |
Field Of | Drawingversions | Contains a list of object representing versions of drawings, typically returned in response to a query. |
Field Of | Folders | A list of Folders returned in response to a query. A folder contains items, such as designs and subfolders. |
Field Of | Hubs | Contains a list of hubs returned in response to a query. A hub is a container of projects, shared resources, and users with a common context. |
Field Of | Items | Contains a list of items returned in response to a query. An item refers to a file or subfolder that exists within a folder. |
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 | Occurrences | Contains a list of occurrences of a component, typically returned as a response to a query. When a version of a component is inserted in an assembly, it is referred to as an occurrence of that component. An assembly can contain multiple occurrences of a version of a component. For example, consider a wheel that contains four lug-nuts. There are four occurrences of the component lug-nut in the wheel assembly. |
Field Of | Projects | Contains a list of projects returned in response to a query. |
Field Of | Properties | List of Properties in a extendableId. |
Field Of | Propertydefinitioncollections | Data object that represents Property Definition Collections. |
Field Of | Propertydefinitions | List of Property Definitions. |