Table of Contents

Search

  1. Preface
  2. Introduction to REST V2 Connector
  3. Connections for REST V2
  4. REST V2 operations
  5. Mappings and mapping tasks with REST V2 Connector
  6. Swagger File Generation
  7. Appendix A: Swagger objects
  8. OpenAPI objects

REST V2 Connector

REST V2 Connector

Uploading a file to a REST endpoint URL

Uploading a file to a REST endpoint URL

You can upload a file to a REST endpoint URL as a part of the REST API call.
To pass a file as an input to REST V2 connector, you must set the content-type to either
multipart/form-data
or
binary
in the request. When the swagger definition has Input parameter of type formData, the file boundary is added to the content of the uploaded file to indicate the start and end of the file. When the swagger definition has Input parameter of type
binary
, the content is generated without having the file boundary.
You must have the
formData
parameter of type
file
defined as one of input parameters in swagger. For example,
{ "name":"file",
"in":"formData",
"description":"file to upload",
"required":false,
"type":"file" }
The following image shows the sample REST V2 object hierarchy:
The image shows a sample REST V2 object hierarchy when you use the formData parameter of type file in the swagger definition.
Use one of the following methods to pass a file as an input:
  • For the
    xxx_FilePath
    input field, specify the complete file path as value in the source. Used for any file formats.
  • For the
    xxx_FileData
    input field, pass the Base64 encoded value of the file in the source. Used for file formats, such as
    .pdf
    ,
    .jpg
    ,
    .xls
    , and
    .doc
    . The length of the Base64 encoded value must not exceed 65535 characters.
  • For the
    xxx_FileData
    input field, pass the file value as string in the source. Used for plain text file formats, such as
    .txt
    ,
    .JSON
    , and
    .xml
    . The file size must not exceed 65535 characters.
The following image shows a sample swagger file to upload a binary file:

0 COMMENTS

We’d like to hear from you!