Technology Blog Posts by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
franz_forsthofer
Product and Topic Expert
Product and Topic Expert
2,808

Partner Directory - Mass Configuration


A typical use case for the Partner Directory is that an application using SAP Cloud Integration has its own configuration application where a configurator user of a partner can enter the partner specific information, like partner ID, HTTP address, authentication method, XSL transformation, XML schemas, used IDs for the receivers, …. This partner specific information is first stored in the configuration application. After the configurator of the partner has successfully entered all relevant information, then a single transactional call replicates the information specific for this partner to the Partner Directory. See the following diagram.


Use Case: Mass Configuration

The transactional behavior of the call ensures that all entries belonging to a specific partner are updated/created/deleted consistently in one call.

Mass Configuration via OData Batch Request


The transactional call is done via OData using the OData batch functionality which defines an OData ChangeSet request.

In such a ChangeSet request you can group several create/update/delete requests for the entity types

    • StringParameter
    • BinaryParameter
    • AuthorizedUser
    • AlternativePartner

Restrictions:

    • The OData entity types UserCredentialParameter and CertificateUserMapping cannot be used together with other entity types in a ChangeSet. Do not use these entity types in a batch request.
    • One batch request can contain only one ChangeSet.

You can find further information about OData batch in http://www.odata.org/documentation/odata-version-2-0/batch-processing/.

We recommend to use an OData2 client library to create the OData batch requests. For example, you can use Olingo: https://olingo.apache.org/doc/odata2/tutorials/batchClientApi.html.

Note that for ChangeSet requests, you need to set the X-CSRF-Token header and use session cookies, as described in the chapter “Authentication” of OData API.

The following snippet shows an example HTTP batch request.

POST /api/v1/$batch HTTP/1.1

Host: <tmn>

Accept: application/json

Content-Type: multipart/mixed; boundary=batch_c64b1345-e553-4023-b4a8-a23d818acc9b

Cookie: <cookies for CSRF session>

X-CSRF-Token: XXXXXXXXX



--batch_c64b1345-e553-4023-b4a8-a23d818acc9b

Content-Type: multipart/mixed; boundary=changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2



--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2

Content-Type: application/http

Content-Transfer-Encoding: binary



POST StringParameters HTTP/1.1

Content-Length: 44

Accept: application/json

Content-Type: application/json



{"Pid":"partner1","Id":"sp1","Value":"sp1v"}

--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2

Content-Type: application/http

Content-Transfer-Encoding: binary



PUT BinaryParameters(Pid='partner1',Id='bp1') HTTP/1.1

Content-Length: 48

Accept: application/json

Content-Type: application/json



{"ContentType":"xsl","Value":"YnAxdl9jaGFuZ2Vk"}

--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2

Content-Type: application/http

Content-Transfer-Encoding: binary



PUT AlternativePartners(Hexagency='6167656E637931',Hexscheme='736368656D6531',Hexid='696431') HTTP/1.1

Content-Length: 26

Accept: application/json

Content-Type: application/json



{"Pid":"partner1"}

--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2

Content-Type: application/http

Content-Transfer-Encoding: binary



POST AuthorizedUsers HTTP/1.1

Content-Length: 33

Accept: application/json

Content-Type: application/json



{"User":"user3","Pid":"partner1"}

--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2

Content-Type: application/http

Content-Transfer-Encoding: binary



DELETE AuthorizedUsers('user1') HTTP/1.1

Accept: application/json

Content-Type: application/json







--changeset_0ecb83cf-fd1f-4e6e-bb30-62a659eeb3e2--

--batch_c64b1345-e553-4023-b4a8-a23d818acc9b--


HTTP OData Batch Request Example

Deleting All Entries of a Partner


It is possible to delete all entries belonging to a certain partner in the Partner Directory via one call. See Requests for Deleting all Entities of a Partner.