KB Article #186600

How to update partner certificates through API in B2Bi

Problem


How to update partner certificates through API in B2Bi


Resolution


1. Find Partner ID, based on the partner name

You can get the partner ID using the following ways:

a> https://<b2bi server host>:6443/rest/v1/tradingPartners?filter=partyName%3D'<partner_name>'&limit=10&offset=0&orderBy=partyName


imageb15273d886f965f3528d40d653dbde49_000.png

b> curl --user "username:password" -k -X 'GET' -k 'https://<b2bi server host>:6443/api/v1/tradingPartners?filter=partyName%3D'\''partner_name'\''&limit=10&offset=0&orderBy=partyName' -H 'accept: application/json'


imaged2ec3696d4423cb57229567b339de97b_000.png

c> Go to UI page -> Click on the partner's name -> check the id mentioned in end of the URL (its a partner ID).


imagec54bd89677692a144adebb93cf3fdddf_000.png

2. Import certificate for the partner.

- The REST API to import a certificate is not available through SWAGGER. More information around the API can be found here in the standard documentation:

https://<b2bi server host>:6443/apidocs/resource_TradingPartnersSecurityResource.html

- This REST API doesn't take a JSON structure for import, but an actual certificate file (transferred as an application/octet-stream content type).

- Place the required certificate at any path on your B2Bi machine and run the below curl command from that path:

curl --user "username:password" -k -H "Content-Type:application/octet-stream" -H "accept:application/json" --data-binary @<certificate_name> -X PUT https://<b2bi server host>:6443/api/v1/tradingPartners/security/<partner_id>/certificate/import


image1a4b67a717a4e6d31f190d2e71de8079_000.png


image5a306846c0d668b14ff9e0e6db08a6dd_000.png