Setting the asset with a Bizagi project

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Bizagi from external applications > Bizagi API > OData RESTful services > Using Bizagi API in middlewares > Using OData with RAML >

Setting the asset with a Bizagi project

Overview

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.

 

Configuration steps

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.

 

raml_9

 

Click Add new instance:

 

raml_10

Register an instance name and the URL of the Work Portal from your Bizagi environment:

 

raml_11

 

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:

 

raml_12

 

Grant Type: Client credentials

Allowed Scope: API

 

Save the Client ID and Client Secret somewhere you can access easily.

 

raml_13

 

In the Anypoint portal, open the Exchange module, and select the asset you previously created.

 

raml_14

 

In the specification panel, open the Endpoints section, then oauth2/server, and finally token. Click the Get auth token endpoint.

 

raml_15

 

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.

 

raml_16

 

Select the Authorization tab, and set the User name with the OAuth Client ID and the Password as the Client Secret:

 

raml_17

 

When you click Send, Mulesoft obtains the authentication token, from the Bizagi environment define in the API instances. Copy this token.

 

raml_18

 

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]

 

raml_19

 

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:

 

raml_20