Example: Get Line Items

Use the CAM REST API Discovery Tool to get a list of line items. Learn how to filter, shape, and sort the list of line items returned from the CAM database.

  1. Get an API key. See Create an API Key.
  2. Open the CAM REST API Discovery Tool using this URL: https://{API host name}/cam/docs/index.html.
  3. Generate an access token. See Access Tokens for the CAM REST API.
  4. Use the access token to authorize CAM REST API use. See Use Tokens to Authorize Access to the CAM REST API Discovery Tool.
  5. Scroll to the LineItems section.
  6. Select Get for the /cam/api/v1/purchases/lineitems operation.
  7. Select Try it out, and then select Execute.
    A list of 10 line items is returned by default.
  8. Optionally, use query parameters to refine the list:
    Option Description
    page Specify the page number of the result set to return. For example, if 105 line items are returned and the page size is 10, page=1 returns items 1-10, page=5 returns items 41-50, etc.
    pageSize Specify the number of line items to return per page. The default setting is 10.
    sort Sort the list by field name and order. Examples:
    • Quantity desc sorts the list by quantity in descending order.
    • Name asc sorts the list by name in ascending order.
    filter Limit the returned list based on items that meet specific criteria. Examples:
    • Name like "*Microsoft*" returns only those line items that include the word Microsoft in their name.
    • Quantity gt 5 returns line items with a quantity of more than 5.
    • UnitPrice le 100 returns line items with a unit price of less than or equal to 100.
    fields Include only data you care about by adding fields. Example:
    • Name, Description, Quantity, UnitPrice includes data for these fields and omits data for all other fields.
  9. Optionally, combine parameters to fully refine your list.
  10. Select Execute, and then compare the request URL to the query parameters you provided.
    This example is returned for these query parameters:
    • pageSize: 50
    • sort: Quantity desc
    • filter: UnitPrice le 100
    • fields: Name, Description, Quantity, UnitPrice

    https://{API host name}/cam/api/v1/purchases/lineitems?pageSize=50&sort=Quantity%20desc&filter=UnitPrice%20le%20100&fields=Name%2C%20Description%2C%20Quantity%2C%20UnitPrice