Nav

FAQ: REST Connect v1.0.0

REST Connect quickly converts a RAML 1.0 API specification to a connector, which you can use in a Mule Application in the Design Center feature of Anypoint Platform.

Which version of RAML specifications does REST Connect support?

REST Connect supports RAML v1.0. If you publish a RAML v0.8 API Specification, you may recieve an alert email. To have an auto-generated connector, convert your API specification to RAML v1.0.

Supported Security Schemes?

REST Connect supports Basic Authentication and OAuth 2.0 client credentials. If you publish an API Specification with another authentication type, you may recieve an alert email. To have an auto-generated connector, update your API specification to use Basic Authentication and OAuth 2.0 client credentials.

Basic Authentication Example:


         
      
1
2
3
4
5
6
7
8
9
#%RAML 1.0
title: Dropbox API
version: 1
baseUri: https://api.dropbox.com/{version}
securitySchemes:
  basic:
    description: |
      This API supports Basic Authentication.
    type: Basic Authentication

OAuth 2.0 Client Credentials Example:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#%RAML 1.0
version: v1
title: Deadlines API
baseUri: http://localhost/deadlines
securitySchemes:
    oauth_2_0:
        description: Deadlines API supports OAuth 2.0 for authenticating all API requests.
        type: OAuth 2.0
        describedBy:
            headers:
                Authorization:
                    description: Sends a valid OAuth 2 access token.
                    type: string
            responses:
                401:
                    description: Bad or expired token.
                403:
                    description: Bad OAuth request.
        settings:
            accessTokenUri: https://api.example.com/1/oauth2/token
            authorizationGrants: [ client_credentials ]

/deadlines:
    get:
        securedBy: [oauth_2_0]
        displayName: Get deadlines.
        description: Get a list of all registered deadlines.
        responses:
            200:
                body:
                    application/json:
                        example: '[ { "rest-connect": "2017-03-13" } ]'

How can I change the auto-generated names for connector operations?

REST Connect generates the names of operations based on operationName, displayName, and endpoint in that order. To modify a generated name, you can point to the REST Connect library and use the operationName annotation from a method such as GET, POST, and DELETE, or you can change the text in displayName under the method.

Example:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#%RAML 1.0
title: Sample API
baseUri: https://jsonplaceholder.typicode.com
version: 0.1
mediaType: application/json

uses:
  rest-connect: exchange_modules/org.mule.connectivity/rest-connect-library/1.0.0/rest-connect-library.raml

  ...
  /{postId}:
    uriParameters:
      postId: integer

    get:
      (rest-connect.operationName): Retrieve a post by id
      displayName: Get a post by ID.
      responses:
        200:
          body:
            type: Post

Does Rest Connect support an OAS file?

REST Connect supports RAML v1.0 and supports OAS through the OAS conversion feature in Exchange 2. Exchange lets you add an OAS file from the Exchange user interface directly and converts it to a RAML. REST Connect generates a connector based on the RAML.

You can also add an OAS file through API Designer in Design Center. API Designer converts the OAS file to a RAML and allows you to publish the RAML to Exchange. Once the RAML is published in Exchange, REST Connect generates a connector based on the RAML.

Why is there no metadata in my generated connector?

REST Connect generates metadata for each operation based on your schema definition in the request and response for each method in your RAML. REST Connect cannot generate metadata based on examples in the RAML.