Testing using API Tester

You can use various tools, such as API Tester, to verify the behavior of your Microflow®.

Prerequisite:

Adding and Deploying Stages

The following example shows how to create a new pet record to Swagger Petstore and upload an image to the record using multipart/form-data content type.

  1. On the Apps page, find the created Microflow application and click Endpoint, and then click View API to open the API Tester.
  2. In the Swagger Petstore, select the POST/ pet method which will post a request to Swagger Petstore service to create a new record.
  3. To define the body parameter Value, click in the Data Type box to copy the Example Value to the parameter Value box.
  4. Select the Parameter content type option from the list. The options are: application/json and application/xml. In this example we use application/json as the request content-type.

    Microflow supports the following content-types for POST and PUT requests:

    • application/json: for sending json format
    • application/xml: for sending xml documents
    • application/x-www-form-urlencoded: for sending name-value pairs type of form data using urlencoded format
    • multipart/form-data: for sending form data that contains files in multipart MIME format
    • text/xml: for sending text/xml documents
  5. Click Try it out.

    A response code 200 indicates that the post is successful and the record has been created.

  6. From the Response Body, copy the id value, for example, 8621025678938727000, that can be used in step 6.
  7. To upload an image to Swagger petstore using multipart/form-data content type, select the POST /pet/{petid}/uploadImage method.
  8. Enter the following parameters values:
    • petId: paste the id value from step 4, for example, 8621025678938727000
    • additionalMetadata: leave it blank
    • file: click the Choose File button and choose an image file from your file system
  9. Click Try it out.

    A Curl message displayed in the following sample indicates the Content-Type “multipart/form-data” is used.

    After a while a response is displayed with the Response Code 200 and the Response Body displays, “File uploaded to ./xxx, xxxxx bytes”, indicating that the image file has been uploaded to this record successfully.