HTTP POST

Purpose

 To trigger a HTTP POST request using Widget API.

Request Format

let postBody = {
    "data": [{api_data}]
};

let postRequest = {
    url: "https://recruit.zoho.com/recruit/v2/Contacts",
    headers: {
        Authorization: "{authtoken}"
    },
    body: postBody
}
ZOHO.RECRUIT.HTTP.post(postRequest)

Sample Request

Copiedlet postBody = {
    "data": [{
        "Company": "Zylker",
        "Last_Name": "Daly",
        "First_Name": "Paul",
        "Email": "p.daly@zylker.com",
        "State": "Texas"
    }],
    "trigger": [
        "approval",
        "workflow",
        "blueprint"
    ]
};

let postRequest = {
    url: "https://recruit.zoho.com/recruit/v2/Contacts",
    headers: {
        Authorization: "Bearer *********************"
    },
    body: postBody
}
ZOHO.RECRUIT.HTTP.post(postRequest)
    .then(function(successResponse) {
       
    }, function(failureResponse) {
        
    });

Sample Response

Copied{
    "data": [{
        "code": "SUCCESS",
        "details": {
            "Modified_Time": "2022-10-07T18:10:25+05:30",
            "Modified_By": {
                "name": "Paul Daly",
                "id": "14501000000366007"
            },
            "Created_Time": "2022-10-07T18:10:25+05:30",
            "id": "14501000002081101",
            "Created_By": {
                "name": "Paul Daly",
                "id": "14501000000366007"
            }
        },
        "message": "record added",
        "status": "success"
    }]
}