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.
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.
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.
- 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.
- 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.
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, the 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.
When you open a Job with a tRESTRequest referencing a deleted API metadata, you will be asked to switch to Built-In mode.
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.