Module Actions

Optionally, you can define the module's action to take advantages of features, read more below.

Create

Used for modules that are creating an object, most of the time, these modules use POST request.

Module: Create a Contact

{
    "url": "/contacts",
    "method": "POST",
    "body": {
    "{{...}}": "{{omit(parameters, 'date')}}",
    "date": "{{formatDate(parameters.date, 'YYYY-MM-DD')}}"
    },
    "response": {
        "output": "{{body}}"
    }
}

Read

Used for modules that are retrieving an object, most of the time, these modules use GET request.

Module: Get a Contact

{
    "url": "/contacts/{{parameters.contact_id}}",
    "method": "GET",
    "response": {
        "output": "{{body}}"
    }
}

There is a difference between List/Search and Get modules although they use the same method "GET".

List/Search modules return multiple bundles and should be Module type: Search.

Get modules return only 1 bundle (specified by the entered ID) and should be Module type: Action.

"Invalid module output. Expected Object, but found Array." error

If you happen to receive this error: Invalid module output. Expected Object, but found Array., it means that your module should be type Search. Type search expects an output type array, and unlike the type action supports pagination directive.

If you don't want to iterate the array returned from the API, you can wrap it in an object:

 "response": {
            "output":
            {
                "myArray": "{{body}}"
            }
        }

Update

Used for modules that are updating an object, most of the time, these modules use PATCH or PUT request.

When a module is type Update, a new keyword appears inside Make - erase.

Module: Update a Contact

{
    "url": "/contacts/{{parameters.contact_id}}",
    "method": "PUT",
    "body": {
        "name": "{{parameters.name}}",
        "email": "{{parameters.email}}",
        "phone": "{{parameters.phone}}",
        "address": "{{parameters.address}}"
    },
    "response": {
        "output": "{{body}}"
    }
}

Delete

Used for modules that are deleting an object, most of the time, these modules use DELETE request.

Module: Delete a Contact

{
    "url": "/contacts/{{parameters.contact_id}}",
    "method": "DELETE",
    "qs": {},
    "headers": {},
    "body": {},
    "response": {
        "output": "{{body}}"
    }
}

Last updated