Updating Event Rules with the Event Management API

This procedure describes how to use the Event Management API to update rule values for an event.

Prerequisites

Context

The PUT /events/{eventId}/rules endpoint of the Event Management API enables you to update rule values for an event. For example, you can update the estimated award date, rule choice, bidding rules and so on for event rules. You can update values for multiple event rules.

Procedure

  1. Use one of the following methods to obtain the ID of the event for which you want to update rules.
    • If the event was created using the POST /events endpoint, use the internalId in the response as the event ID.

    • If the event was created from a sourcing request received from an external system, use the GET /events endpoint and specify the RFQ ID sent by the external system (the RequestID sent in the cXML QuoteRequest) as the externalSystemCorrelationId query parameter value. Use the internalId in the response as the event ID.

    • View the event ID in the user interface:

      • The classic SAP Ariba Sourcing user interface shows the event ID below the Overview tab, in the ID field.

      • The guided sourcing user interface shows the event ID in the upper left corner of the event page, below the event name.

  2. Use the GET /events/{eventId}/rules endpoint to retrieve event rules.

    Example:

    GET {{runtime_URL}}/events/DOC4567/rules?user=myUser&passwordAdapter=PasswordAdapter1&realm=mySite

    The Event Management API returns information about the event rules, including the current values, valid values, and the fieldName.

    For example:

    {
        [
           ...,
            {
                "id": 2,
                "label": "Can participants see ranks?",
                "fieldName": "OwnRankingInfoRelease",
                "valueType": 3,
                "ruleValue": {
                    "stringValue": "Their own rank when leading"
                },
                "property": 0,
                "ruleChoices": [
                    {
                        "choiceName": "No",
                        "choiceValue": 0,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Their own rank when leading",
                        "choiceValue": 1,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Their own rank",
                        "choiceValue": 2,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "All participants ranks",
                        "choiceValue": 3,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Only when winning",
                        "choiceValue": 1,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Yes",
                        "choiceValue": 2,
                        "booleanValue": null
                    }
                ],
                "validity": null
            },
           ...
        ]
    }
  3. Use the PUT /events/{eventId}/rules endpoint to update the event rules.

    Example:

    PUT {{runtime_URL}}/events/DOC4567/rules?user=myUser&passwordAdapter=PasswordAdapter1&realm=mySite
    At a minimum, the request body must contain the following elements:
    • id

    • fieldName

    • valueType

    • ruleValue

    The property element indicates the rule type:
    • 0 - Delegated

    • 2 - Read Only

    • 3 - Hidden

    Use the following data model for the request body to update values for multiple rules:

    [
        {
            "id": 2,
            "label": "Can participants see ranks?",
            "fieldName": "OwnRankingInfoRelease",
            "valueType": 3,
            "ruleValue": {
                "stringValue": "Rank when leading"
            },
            "property": 0,
            "ruleChoices": [
                {
                    "choiceName": "No",
                    "choiceValue": 0,
                    "booleanValue": null
                },
                {
                    "choiceName": "Their own rank when leading",
                    "choiceValue": 1,
                    "booleanValue": null
                },
                {
                    "choiceName": "Their own rank",
                    "choiceValue": 2,
                    "booleanValue": null
                },
                {
                    "choiceName": "All participants ranks",
                    "choiceValue": 3,
                    "booleanValue": null
                },
                {
                    "choiceName": "Only when winning",
                    "choiceValue": 1,
                    "booleanValue": null
                },
                {
                    "choiceName": "Yes",
                    "choiceValue": 2,
                    "booleanValue": null
                }
            ],
            "validity": null
        },
        {
            "id": 3,
            "label": "Show lead bid to all participants",
            "fieldName": "LeadBidInfoRelease",
            "valueType": 3,
            "ruleValue": {
                "stringValue": "After participant's first response is accepted"
            },
            "property": 0,
            "ruleChoices": [
                {
                    "choiceName": "Yes",
                    "choiceValue": 0,
                    "booleanValue": null
                },
                {
                    "choiceName": "After participant's first response is accepted",
                    "choiceValue": 1,
                    "booleanValue": null
                },
                {
                    "choiceName": "No",
                    "choiceValue": 2,
                    "booleanValue": null
                }
            ],
            "validity": null
        }
    ]
    

    The Event Management API returns the updated event rule details.

    For example:

    {
        [
            {
                "id": 2,
                "label": "Can participants see ranks?",
                "fieldName": "OwnRankingInfoRelease",
                "valueType": 3,
                "ruleValue": null,
                "property": 0,
                "ruleChoices": [
                    {
                        "choiceName": "No",
                        "choiceValue": 0,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Their own rank when leading",
                        "choiceValue": 1,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Their own rank",
                        "choiceValue": 2,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "All participants ranks",
                        "choiceValue": 3,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Only when winning",
                        "choiceValue": 1,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "Yes",
                        "choiceValue": 2,
                        "booleanValue": null
                    }
                ],
                "validity": null
            },
            {
                "id": 3,
                "label": "Show lead bid to all participants",
                "fieldName": "LeadBidInfoRelease",
                "valueType": 3,
                "ruleValue": {
                    "stringValue": "After participant's first response is accepted"
                },
                "property": 0,
                "ruleChoices": [
                    {
                        "choiceName": "Yes",
                        "choiceValue": 0,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "After participant's first response is accepted",
                        "choiceValue": 1,
                        "booleanValue": null
                    },
                    {
                        "choiceName": "No",
                        "choiceValue": 2,
                        "booleanValue": null
                    }
                ],
                "validity": null
            }
        ]
    }
    

    To troubleshoot your queries to the Event Management API, refer to Error Messages Returned by the Event Management API.