How to attach a before operation rule to a web service connector for an operation?

How to attach a before operation rule to a web service connector for an operation?

Hi Amrit,
Here you can find how to do that
https://documentation.sailpoint.com/connectors/webservices/help/integrating_webservices/beforeafteropsrule.html

If you already have the rule created in your tenant, then go into Visual Studio Code, find the action you want to add it to and add a line for “beforeRule” and set it to your rule name. Here is an example of an “Add Entitlement” call with a before rule configured (third line from the bottom):

            {
                "httpMethodType": "PATCH",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "5",
                "uniqueNameForEndPoint": "Add User to Group - 1",
                "curlCommand": null,
                "rootPath": "$",
                "body": {
                    "bodyFormData": null,
                    "jsonBody": "{\n   \"schemas\":[\n      \"urn:ietf:params:scim:api:messages:2.0:PatchOp\"\n   ],\n   \"Operations\":[\n      {\n         \"op\":\"add\",\n         \"path\":\"members\",\n         \"value\":[\n            {\n               \"value\":\"$request.nativeIdentity$\"\n            }\n         ]\n      }\n   ]\n}",
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": [
                    "2**"
                ],
                "resMappingObj": null,
                "contextUrl": "Groups/$request.groups$",
                "pagingSize": 50,
                "curlEnabled": false,
                "header": null,
                "operationType": "Add Entitlement",
                "beforeRule": "My before rule name",
                "xpathNamespaces": null,
                "parentEndpointName": null
            }```

To attach a before provisioning rule use the below API.
PATCH : {{api-url}}/v3/sources/{{sourceid}}
[
{
“op”: “add”,
“path”: “/connectorAttributes/connectionParameters/10/beforeRule”,
“value”: “Name of the Rule”
}
]

Number 10 here will the operation order which you have define. For that you can first do a get call on {{api-url}}/v3/sources/{{sourceid}} get the number and then add it.

Let me know if you face any issue while calling the api.

Thanks
Rakesh