Test Service Connection Responses
You can configure a POST/PATCH/PUT REST API with application/octet-stream or multipart/form-data format and test it from the service connection's endpoint's Test tab before proceeding with it. You can also use the form-data's schema when you call the REST endpoint.
You can access this functionality from two places, where you can use radio buttons to select the payload type to test:
- From the Body tab under the Endpoint editor's Request tab:
- From the Body panel under the Test tab:
In both screenshots, the Text payload option is selected. The body input area beneath the radio buttons looks and operates the same way it has in all prior releases.
Test Responses Using the Form Data Option
When you select the Form-Data payload option, the Media Type is automatically changed to multipart/form-data and you're presented with a form for defining input elements that provide the data values in a multipart request body:
Two types of input elements can be created:
- String, for providing a user-entered text value.
- File, for selectiing a file to provide a binary data value.
As elements are added to the form, corresponding properties will be added to the media type's schema in the OpenAPI metadata:
When the request is submitted from the Test tab, the names and values of the inputs are used to generate a FormData object that defines the multipart payload.
When form elements are created and displayed in the Request tab, the input elements themselves (that is, the text field or file picker) aren't rendered, because testing and submitting the form data can't be performed in this context:
Test Responses Using the Binary Option
When you select the Binary payload option, the media type defaults to application/octet-stream, although you could manually enter any binary content type you want:
After you click the Create Binary-Compatible Schema button, the corresponding schema will be generated.
After the schema has been created, you can use the file picker to select the file that'll be used as binary payload when the request is submitted:
The file picker for the Binary payload type isn't shown in the Request tab:
Instead, a message indicates that the schema has been created.
Service endpoints support downloading binary or text responses in the endpoint's Test tab. You can use the Download button to save the response body. If the response is non-text, you'll see a message that tells you that the response body contains binary data:
You can also use the Download button to download or save text responses: