Skip to main content

Using REST metadata with Jobs and Routes

Once the REST API metadata is created, you can use it in the tRESTRequest component with Jobs and cREST with Routes.

In the Basic settings view of the tRESTRequest component, select Repository from the Definition list.

Basic settings view of tRESTRequest.
Click [...] next to the Definition field to show the Repository Content wizard where the REST API metadata that have been created in the repository are shown.
REST API Definitions metadata.
Choose an API specification from the metadata that you want to use in the tRESTRequest component and click OK.

Another way to achieve this is to drag and drop an API from metadata node to a newly created Job which will create a new tRESTRequest component already set up.

Basic settings view of tRESTRequest with REST API Mapping.
The REST Endpoint field, the REST API Mapping table and the Documentation tab are filled with all relevant parameters automatically. You can update these properties as needed.

The REST Endpoint field is filled with the URL without scheme, host, and port. For example, if source URL is http://myhost:8090/v1, only "/v1" is kept for endpoint.

In the REST API Mapping table, the HTTP Verb, URI Pattern, Consumes, Produces fields are filled based on the information in the API specification.

For the Output Flow column, the following rule is applied during the import:
  • If the OperationID exists in the specification, then this value is used for the Output Flow column. If not, the summary field in the specification is used with a limitation of 120 characters. Blanks will be replaced by underscores.
  • If neither the Operation ID or Summary field exists in the specification, or if they contain other non-supported characters than blanks, the Output Flow column will stay empty and you have to fill it in manually.
For tRESTRequest only, the following rules are applied during the import of the Schema as part of the Output Flow:
  • A static mapping between OAS 2 Primitive Types to Talend Schema types (like Integer, String, and so on.)
  • The following Parameter types are supported and will be set in the Comment field of the schema.
    • Path Parameter to Comment value: path
    • Query Parameter to Comment value: query
    • Header Parameter to Comment value: header
  • The following Parameter types are not supported for the Comment field as part of the import, but can be manually added later in case your service design would require them:
    • Form Parameter
    • Matrix Parameter
    • multipart
  • If the specification contains default values for parameters, the default values of these parameters (Header, Query, Path) will be set into the Default column of the schema.
  • The Object, Array, Date, Time, and Datetime type data will be set to a String Type Column during the import. As these types are mapped to String, it is not supported to transfer the default value as part of the import.
  • The Nullable column will not be imported, but stay on default value during import.
Information noteNote: Header Parameters names with dashes, such as Content-Type or Access-Key are not supported. If you import REST API metadata containing header names with dashes from a file or from Talend Cloud API Designer, they may cause errors.

Security information set in the API Designer or within an OAS 2.0 Specification will not be imported to the tRESTRequest component. You can choose from the security options which are provided by the Talend ESB as part of the Job Implementation.

Each time you open a Job with a tRESTRequest referencing an API metadata from the repository, Talend Studio will test if an update is needed according to the linked metadata content. If the API metadata is updated in the repository, a confirmation is prompt for update of tRESTRequest parameters with the following message. You can choose to keep the endpoint existing value or not.

"Initialize component?" dialog box.

When you open a Job with a tRESTRequest referencing a deleted API metadata, you will be asked to switch to Built-In mode.

"Update Detection" dialog box.

The cREST component can be initialized with an API definition from metadata in the same way in a Route design as the tRESTRequest in a Job.

For Data Services and Routes using either the tRESTRequest or cREST component, if one of the REST components is using a REST metadata from API Designer, the following actions are available from the context menu:

  • Open in API Designer: open an external web page displaying the API Definition in API Designer.
  • Open API documentation: open an external web page displaying the documentation of the API. For this action it is necessary that the API Documentation is published in the Talend Cloud API Designer. Otherwise the documentation is not available and cannot be viewed with this menu option.
  • Open in API Tester: open Talend Cloud API Tester within your local Chrome Browser. The Test Project will be initialized with the current API Definition if no project already exists.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!