Suppose we want to get company profile or verify a company address based on a DUNS number.
Prerequisites for the Dun and Bradstreet API integration are:
1. User token and password from Dun & Bradstreet
2. Authorization token to connect to the API
First we will create the connection to D&B API for getting standard company profile.The REST API for this is:
OrderProduct is one of many operations or products that are support by Dun & Bradstreet API please refer to this link for more information.
In Adeptia Suite go to Develop > Services > Web Services > Consumer and create the following RESTful API connection as shown below.
Notice that in the Parameter field I have added the Authorization token. Refer below on how to get the token.
In the URL field I have provided a template URL value as https://maxcvservices.dnb.com/version/organizations/DUNS/products/productID
Since we will be providing the actual dynamic URL at run time in the process flow we can provide a template value and save the activity.
Open up the process designer and create a flow as shown below.
First activity is a put-context-var action that contains the actual REST URL as shown below.
Context target will hold the JSON response. You can also convert the JSON into XML. Refer to the support forum post on JSON for more information.
If XML is needed then put the JSONtoXML custom plugin after the Web Service activity and then map the output data stream of the custom plugin to the target activity which will consume the data. Use multiple stream option in the custom plugin and give the data stream name as default and map to the target activity
Attached is the sample JSON response based on the actual REST API URL i the put-context-var.
To get the Authorization token you can call the REST API URL first:
Pass the User token and the Password in the header and you will get the Authorization token which needs to be passed in the above REST call to get the Company profile. Refer to this link to get more help on how to get the credentials http://developer.dnb.com/docs/2.0/guides/DnBDirect2-Ordering-Reports.pdf