Searching for Contract Workspaces Using the Contract Workspace Retrieval API

Use this procedure to retrieve details of the contract workspaces created in SAP Ariba to your client application by applying different search and filter criteria available with the Contract Workspace Retrieval API.

Prerequisites

You have the contract workspace attributes such as the contract type (for example, service contract), title, ID, region, and so on, as required by the API parameters to search and filter data.

Context

The GET /contractworkspaces endpoint of the Contract Workspace Retrieval API enables you to search contract workspaces in the system.

You can choose the contract workspace attributes that you want to retrieve by specifying them in the select clause of the search query, for example, Contract Type, Title, Contract ID, Region, and so on. For a complete list of contract workspace attributes that can be specified in the select clause, see Contract Workspace Attributes Eligible for Specifying in the Select Clause to Search for Contract Workspaces.

You can further streamline the search results by applying filter criteria using the following contract workspace attributes:

  • Title

  • Last Modified Date

  • Document Type

  • Include Deleted

  • Contract Status

  • Integrated Systems

Procedure

  1. Invoke the GET /contractworkspaces endpoint to retrieve a list of contract workspaces matching the search criteria.

    Request type: GET

    URL: {{runtime_url}}/contractworkspaces

  2. (Optional) Use the required query parameters to search and filter the result set.

    The following example request URL gets information about contracts matching the provided title:

    {{runtime_url}}contractWorkspaces?$filter=Title eq CW&$top=500&$count=true&user={username}&passwordAdapter={password}&realm={realm}&$select=Title,ContractId,ContractStatus,Supplier,TimeZoneID,EffectiveDate,ExpirationDate,CreateDate,Version,LastPublishedDate,AmendmentType,AmendmentReason,Origin,HierarchicalType,ParentAgreement,ExpirationTermType,Commodity,Region

    The following table describes the query parameters that allow you to filter the result set.

    Parameter

    Description

    $select

    This parameter is used to specify the fields of the contract workspace that the API must fetch.

    In this example, the API fetches the Title, ContractId, and Region fields of the contract workspace.

    $filter

    This parameter is used to apply filter criteria for the search query. The following contract workspace attributes can be used as filter criteria:

    • Title

    • Last Modified Date
    • Include Deleted

    • Contract Status

    • Integrated Systems

    In this example, the API fetches the contract workspaces modified between 2010-11-15T21:22:22Z and 2022-9-12T23:22:22Z, with the title as Service Contract, including deleted contract workspaces in the Draft or Published state that are integrated with the external system ABC.

    $top

    This parameter specifies the number of contracts to fetch.

    $skip

    This parameter specifies the number of contracts to skip (offset) from the beginning of the result set for uses, such as pagination. The default value is 0.

    $count

    If set to true, this parameter specifies the count of contracts.

    $expand

    This parameter specifies additional information to fetch such as the plant information provided by suppliers in the “Retail Contract Terms” object of the Contract Workspace. This is an optional parameter and is used only when you have integrated Retail Sourcing with SAP Ariba Contracts.

    realm

    This parameter specifies the unique identifier for your SAP Ariba site.

    user and passwordAdapter

    These parameters specify your API credentials.

Contract Workspace Attributes Eligible for Specifying in the Select Clause to Search for Contract Workspaces

You can construct a search query to retrieve specific attributes of a contract workspace using the Contract Workspace Retrieval API. The contract workspace attributes that you can explicitly specify in the select clause of the search query are listed below.
  • Title

  • Owner

  • Contract Id

  • ContractStatus

  • Supplier

  • Effective Date

  • Expiration Date

  • Creation Date

  • Amount

  • Version

  • Template Id

  • Business System Id

  • Amendment Type

  • Amendment Reason

  • Origin

  • Hierarchical Type

  • Parent Agreement

  • Expiration Term Type

  • Commodity

  • Region

  • Internal Id