Operations (sample payloads)

Main operations

DELETE

Send a DELETE request. Sample Input

{
    "url": "https://api.example.com/users/123",
    "auth": {
        "basic_auth": \{
            "username": "apiuser",
            "password": "secretpassword"
        \}
    },
    "headers": [
        \{
            "key": "Content-Type",
            "value": "application/json"
        \}
    ],
    "status_code": {
        "range": \{
            "from": 200,
            "to": 204
        \}
    },
    "parse_response": "json"
}

Sample Output

{
    "response": {
        "status_code": 204,
        "headers": \{
            "Content-Type": "application/json",
            "Date": "Wed, 15 Mar 2023 10:30:45 GMT",
            "Server": "nginx/1.18.0"
        \},
        "body": null
    }
}

GET

Send a GET request. Sample Input

{
    "url": "https://api.example.com/users",
    "auth": {
        "basic_auth": \{
            "username": "apiuser",
            "password": "secretpassword"
        \}
    },
    "headers": [
        \{
            "key": "Accept",
            "value": "application/json"
        \}
    ],
    "queries": [
        \{
            "key": "limit",
            "value": "10"
        \},
        \{
            "key": "offset",
            "value": "0"
        \}
    ],
    "follow_redirect": true,
    "parse_response": "true",
    "status_code": {
        "range": \{
            "from": 200,
            "to": 299
        \}
    }
}

Sample Output

{
    "response": {
        "status_code": 200,
        "headers": \{
            "Content-Type": "application/json",
            "X-RateLimit-Limit": "100",
            "X-RateLimit-Remaining": "99"
        \},
        "body": {
            "users": [
                \{
                    "id": 1,
                    "name": "John Doe",
                    "email": "john.doe@example.com"
                \},
                \{
                    "id": 2,
                    "name": "Jane Smith",
                    "email": "jane.smith@example.com"
                \}
            ],
            "total": 2,
            "limit": 10,
            "offset": 0
        }
    }
}

Send a HEAD request. Sample Input

{
    "url": "https://api.example.com/users",
    "auth": {
        "basic_auth": \{
            "username": "apiuser",
            "password": "secretpassword"
        \}
    },
    "headers": [
        \{
            "key": "Accept",
            "value": "application/json"
        \},
        \{
            "key": "User-Agent",
            "value": "Tray.io-Connector"
        \}
    ],
    "queries": [
        \{
            "key": "limit",
            "value": "10"
        \}
    ],
    "follow_redirect": true,
    "reject_unauthorized": true,
    "status_code": {
        "range": \{
            "from": 200,
            "to": 299
        \}
    }
}

Sample Output

{
    "response": \{
        "status_code": 200,
        "headers": "Content-Type: application/json\nContent-Length: 1234\nServer: nginx/1.18.0\nDate: Mon, 15 May 2023 10:30:45 GMT\nConnection: keep-alive\nAccess-Control-Allow-Origin: *\nCache-Control: no-cache, no-store, must-revalidate"
    \}
}

PATCH

Send a PATCH request. Sample Input

{
    "url": "https://api.example.com/users/123",
    "auth": {
        "basic_auth": \{
            "username": "apiuser",
            "password": "secretpassword"
        \}
    },
    "headers": [
        \{
            "key": "Content-Type",
            "value": "application/json"
        \}
    ],
    "body": {
        "raw": \{
            "name": "John Doe",
            "email": "johndoe@example.com"
        \}
    },
    "status_code": {
        "range": \{
            "from": 200,
            "to": 204
        \}
    }
}

Sample Output

{
    "response": {
        "status_code": 200,
        "headers": \{
            "Content-Type": "application/json",
            "Date": "Wed, 15 Mar 2023 10:30:00 GMT",
            "Server": "nginx/1.18.0"
        \},
        "body": \{
            "id": 123,
            "name": "John Doe",
            "email": "johndoe@example.com",
            "updated_at": "2023-03-15T10:30:00Z"
        \}
    }
}

POST

Send a POST request. Sample Input

{
    "url": "https://api.example.com/users",
    "auth": {
        "basic_auth": \{
            "username": "myusername",
            "password": "mypassword"
        \}
    },
    "headers": [
        \{
            "key": "Content-Type",
            "value": "application/json"
        \}
    ],
    "body": {
        "raw": \{
            "name": "John Doe",
            "email": "john.doe@example.com",
            "age": 30
        \}
    },
    "status_code": {
        "range": \{
            "from": 200,
            "to": 299
        \}
    },
    "parse_response": "true"
}

Sample Output

{
    "response": {
        "status_code": 201,
        "headers": \{
            "Content-Type": "application/json",
            "Location": "https://api.example.com/users/123"
        \},
        "body": \{
            "id": 123,
            "name": "John Doe",
            "email": "john.doe@example.com",
            "age": 30,
            "created_at": "2023-05-10T14:30:00Z"
        \}
    }
}

PUT

Send a PUT request. Sample Input

{
    "url": "https://api.example.com/users/123",
    "auth": {
        "basic_auth": \{
            "username": "apiuser",
            "password": "secretpassword"
        \}
    },
    "headers": [
        \{
            "key": "Content-Type",
            "value": "application/json"
        \}
    ],
    "body": {
        "raw": \{
            "name": "John Doe",
            "email": "john.doe@example.com",
            "age": 30
        \}
    },
    "status_code": {
        "range": \{
            "from": 200,
            "to": 204
        \}
    },
    "parse_response": "true"
}

Sample Output

{
    "response": {
        "status_code": 200,
        "headers": \{
            "Content-Type": "application/json",
            "Server": "nginx/1.18.0",
            "Date": "Wed, 15 Mar 2023 10:30:45 GMT"
        \},
        "body": \{
            "id": 123,
            "name": "John Doe",
            "email": "john.doe@example.com",
            "age": 30,
            "updated_at": "2023-03-15T10:30:45Z"
        \}
    }
}

DDL operations

List content types (DDL)

Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping


Sample Input

{
    "url": "https://api.example.com/content-types"
}

Sample Output

{
    "contentTypes": [
        {
            "id": "article",
            "name": "Article",
            "fields": [
                \{
                    "id": "title",
                    "type": "string",
                    "required": true
                \},
                \{
                    "id": "body",
                    "type": "text",
                    "required": true
                \},
                \{
                    "id": "author",
                    "type": "string",
                    "required": false
                \},
                \{
                    "id": "publishDate",
                    "type": "date",
                    "required": true
                \}
            ]
        },
        {
            "id": "product",
            "name": "Product",
            "fields": [
                \{
                    "id": "name",
                    "type": "string",
                    "required": true
                \},
                \{
                    "id": "description",
                    "type": "text",
                    "required": false
                \},
                \{
                    "id": "price",
                    "type": "number",
                    "required": true
                \},
                \{
                    "id": "inStock",
                    "type": "boolean",
                    "required": true
                \}
            ]
        }
    ]
}

Was this page helpful?