Changing the State of a Contract Workspace by Using the Contract Workspace State Change API

Use this procedure to change the status of the contract workspace from draft or draft amendment to publish by using the Contract Workspace State Change API.

Prerequisites

  • To create an application and request access to use the SAP Ariba APIs relevant to this feature, you must have access to the SAP Ariba Developer Portal. For details refer to Steps to Start Using the SAP Ariba APIs in Help for the SAP Ariba Developer Portal.

  • All queries made to this API must be authenticated using OAuth authentication. For details refer to SAP Ariba Developer Portal Authentication in Help for the SAP Ariba Developer Portal.

  • In suite-integrated solutions, if you want contract requests invoked through the publish action of the Contract Workspace State Change API to be automatically approved in SAP Ariba, ensure that the Application.Contract.EnableAutoApprovalOfCRsInvokedThroughPublishAction parameter is set to Yes. By default, this parameter is set to Yes so that the contract requests are automatically approved in SAP Ariba. When this parameter is set to No, the contract requests go through the manual approval workflow. For information on the parameter, see Enable auto approval of contract requests invoked through Publish action.

  • Users who manage the procurement contract workspace information must be members of the Contract Administrator group.

Context

The POST /contractWorkspaces/{contractId}/state endpoint of the Contract Workspace State Change API enables you to change the status of the contract workspace from draft or draft amendment to publish. On successful submission of the API request, a jobId is returned by the Contract Workspace State Change API. Using the jobId, you can get the status of an asynchronous job request. For more information about getting the status of an asynchronous job request, see Getting the Status of an Asynchronous Job Using the Asynchronous Requests Management API.

Procedure

  1. Obtain the ID of the contract workspace for which you want to change the state.
  2. Invoke the /contractWorkspaces/{contractId}/state endpoint:
    POST {{runtime_url}}/contractWorkspaces/{contractId}/state?user=user1&passwordAdapter=pwd1&realm=realm1
    {
      "action": "publish"
    }
     
    where
    contractId
    denotes the ID of the contract workspace that you want to update.
    action
    specifies the action you want to perform on the workspace. Valid value: publish
    The Contract Workspace State Change API returns the job ID and a message indicating the status of the request.
    {
        "jobId": "AAAAAA00Aaa",
        "message": "Job submitted successfully. Use jobId to get status of the job."
    }
    where
    jobId
    indicates the job ID after the API request is submitted successfully. Using the jobId, you can get the status of an asynchronous job request. For more information about getting the status of an asynchronous job request, see Getting the Status of an Asynchronous Job Using the Asynchronous Requests Management API.
    message
    contains the message indicating the status of the request.

    For a list of error messages, see Error Messages Returned by the Contract Workspace Management APIs.