Request

Response

    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:

    1. 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
    2. In the Query Variables Pane, enter the hubId to which the Property collection is mapped.

      Query Variables

      {
        "hubId": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2"
      }
      
    3. 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

    Step 2 - Navigate to the next page using a cursor

    This step demonstrates how to use the acquired cursor to browse through the data on the remaining pages that contain the search results. To navigate to the next page, we will use the previously generated encoded cursor value as "cursor": "MTB-MTA" in our query to fetch data set. To establish the search index, the obtained encoded cursor must be passed in the query pane like this: pagination: {cursor: "MTB-MTA"}.

    1. Enter the following query in the query pane.

      Query

      query propertyDefinitionCollectionsByHub($hubId: ID!) {
              propertyDefinitionCollectionsByHubId(hubId: $hubId, pagination: {cursor: "MTB-MTA"}) {
                pagination {
                  pageSize
                  cursor
                }
                results {
                  id
                  name
                }
              }
            }
      
      Show More

    1. In the Query Variables Pane, enter the hubId to which the Property collection is mapped.

      Query Variables

      {
        "hubId": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2"
      }
      
    2. Click Play. After clicking the “Play” button, the response will display a list of five property collections, with a subsequent cursor "cursor": "MTB-MTA".

      Response

      {
       "data": {
                "propertyDefinitionCollectionsByHubId": {
                      "pagination": {
                          "pageSize": 5,
                          "cursor": "MjB-MTA"
                      },
                      "results": [
                          {
                            "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35UZXN0Q29sbGVjdGlvbjM4MjUzNg",
                            "name": "TestCollection382536"
                        },
                        {
                            "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfNjY3MjQ",
                            "name": "prop_def_col_66724"
                        },
                        {
                            "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfNzIwMzQ",
                            "name": "prop_def_col_72034"
                        },
                        {
                            "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35UZXN0Q29sbGVjdGlvbjM4MjUzNl8y",
                            "name": "TestCollection382536_2"
                        },
                        {
                            "id": "cHJvcGRlZmNvbH5tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35tbDRlSDJHUWo5cFJ0T0NHSGNPMVZBRHJNc2VsVVNlR35wcm9wX2RlZl9jb2xfNDc0ODE",
                            "name": "prop_def_col_47481"
                        },
                      ]
                    }
                  }
                }
      
      Show More

    In the response, you can see that the new set of results is generated with a new cursor value as "cursor": "MjB-MTA". You can now use this cursor that is "cursor": "MjB-MTA" as an index to generate the next set of results. You can keep using the obtained cursor value as a search index in every new query until there are no more results left to display.

    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.

    UsageUsed ByDescription
    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.