After creating an asset in Anypoint, you have to relate the asset to a Bizagi environment, so you can invoke the OData methods of that Work Portal. This article explains how to associate a Bizagi environment with the RAML asset.
First, you need to define the URL of the Bizagi environment that you want to access using the RAML descriptor. To do that, log in your Anypoint portal, open the Exchange module, and select API Instances on the specification panel.
Click Add new instance:
Register an instance name and the URL of the Work Portal from your Bizagi environment:
You can define whether this instance is Public or Private for all your Mulesoft applications. Finally, click the check icon.
As mentioned before, an RAML asset configured in Anypoint is a descriptor of the Bizagi OData layer. This layer relies on OAuth 2 to authenticate external systems accessing a Bizagi project. Therefore, to use the Mulesoft asset, you need to set a pair of OAuth keys in your Bizagi project.
Learn how to get started with OData.
Set the OAuth 2 application In your Bizagi environment as follows:
Grant Type: Client credentials
Allowed Scope: API
Save the Client ID and Client Secret somewhere you can access easily.
In the Anypoint portal, open the Exchange module, and select the asset you previously created.
In the specification panel, open the Endpoints section, then oauth2/server, and finally token. Click the Get auth token endpoint.
To invoke any of the Bizagi OData methods, you need to get authentication from Bizagi using the OAuth 2 protocol. Therefore, the external application has to obtain an authentication token before proceeding. On the details panel, select the API instance of the Bizagi project.
Select the Authorization tab, and set the User name with the OAuth Client ID and the Password as the Client Secret:
When you click Send, Mulesoft obtains the authentication token, from the Bizagi environment define in the API instances. Copy this token.
Now you can test the invocation of an OData method. You can select a method from the endpoint list, for example, List of All Open Cases. In the Authorization tab of this endpoint, paste the token after the word Bearer, with a space between the word and the token: Bearer [Token]
Make sure that you select the same Bizagi environment from the drop-down list. Then click Send. You get the JSON response for that method: