How can we help?
{{docApp.searchError}}
{{product.name}}
Searching in {{docApp.searchFilterBySpecificBookTitle}}
{{docApp.searchResultFilteredItems.length}} results for: {{docApp.currentResultsSearchText}}
in {{docApp.searchFilterBySpecificBookTitle}}
Search results have been limited. There are a total of {{docApp.searchResponse.totalResultsAvailable}} matches.
You have an odd number of " characters in your search terms - each one needs closing with a matching " character!
-
{{resultItem.title}}
{{resultItem.url}}
{{docApp.libraryHomeViewProduct.title || docApp.libraryHomeViewProduct.id}}
{{docApp.libraryHomeViewProduct.description}}
{{group.title || group.id}}
{{group.description}}
Operation Information
- Application Reference:
com.hornbill.core
- Scope:
Entity - Contact
- Class:
Entity
- Required Privilege Level:
basic
- Required Rights: none
Description
For internal use only - Add Contact by ID
Request Parameters
The add API takes the following input parameters. It is important to note that the parameters must satisfy the requirement of the input validation checks.
Name | Type | Required | Description |
---|---|---|---|
firstname |
xs:string |
Yes | Contact First Name |
lastname |
xs:string |
Yes | Contact Last Name |
email1 |
xs:string |
Yes | Contact Email |
email2 |
xs:string |
No | Contact Second Email |
email3 |
xs:string |
No | Contact Third Email |
tel1 |
xs:string |
No | Contact Telephone |
tel2 |
xs:string |
No | Contact Second Telephone |
tel3 |
xs:string |
No | Contact Third Telephone |
organizationId |
xs:string |
No | Organization ID of the related Organization |
jobtitle |
xs:string |
No | Contact Job Title |
description |
xs:string |
No | Contact Description |
company |
xs:string |
No | Contact Company |
notes |
xs:string |
No | Contact place to add long text |
country |
xs:string |
No | The ISO 3166 alpha 2 country code that the contact is located in. If not set, the country set for the portal account is assumed |
region |
xs:string |
No | Logical location of the contact |
language |
xs:string |
No | The RFC3066 language code defined for this contact |
timezone |
xs:string |
No | The timezone that the Contact is located in If not set, the timezone set the portal account is assumed |
status |
xs:int |
No | Contact Status: 0 = active, 1 = suspended, 2 = archived/deleted - XMLMC accountStatusType |
owner |
xs:string |
No | Contact Owner |
type |
xs:int |
No | Contact Type: 0 (or null) = Contact, 1 = visitor |
private |
xs:int |
No | If 1 then this contact should only be visible to the h_owner. If h_owner is not set then is visible to everyone regardless |
activityStreamId |
xs:string |
No | The field used to store the activity stream id for the organization |
custom_1 |
xs:string |
No | Contact Custom 1 |
custom_2 |
xs:string |
No | Contact Custom 2 |
custom_3 |
xs:string |
No | Contact Custom 3 |
custom_4 |
xs:string |
No | Contact Custom 4 |
custom_5 |
xs:string |
No | Contact Custom 5 |
custom_6 |
xs:string |
No | Contact Custom 6 |
Response Parameters
Name | Type | Description |
---|---|---|
id |
xs:string |
Contact Id |
Code Examples
curl -X POST 'https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact' \
-H 'Authorization: ESP-APIKEY yourHornbillAPIKey' \
-H 'Content-Type: application/json' \
-d '{"@service":"apps/com.hornbill.core/Contact","@method":"add","params":{"firstname":"xs:string","lastname":"xs:string","email1":"xs:string","email2":"xs:string","email3":"xs:string","tel1":"xs:string","tel2":"xs:string","tel3":"xs:string","organizationId":"xs:string","jobtitle":"xs:string","description":"xs:string","company":"xs:string","notes":"xs:string","country":"xs:string","region":"xs:string","language":"xs:string","timezone":"xs:string","status":1,"owner":"xs:string","type":1,"private":1,"activityStreamId":"xs:string","custom_1":"xs:string","custom_2":"xs:string","custom_3":"xs:string","custom_4":"xs:string","custom_5":"xs:string","custom_6":"xs:string"}}'
package main
import (
"fmt"
apiLib "github.com/hornbill/goApiLib"
)
func main() {
hornbillAPI := apiLib.NewXmlmcInstance("yourinstanceid")
hornbillAPI.SetAPIKey("yourHornbillAPIKey")
hornbillAPI.SetJSONResponse(true)
hornbillAPI.SetParam("firstname", "xs:string")
hornbillAPI.SetParam("lastname", "xs:string")
hornbillAPI.SetParam("email1", "xs:string")
hornbillAPI.SetParam("email2", "xs:string")
hornbillAPI.SetParam("email3", "xs:string")
hornbillAPI.SetParam("tel1", "xs:string")
hornbillAPI.SetParam("tel2", "xs:string")
hornbillAPI.SetParam("tel3", "xs:string")
hornbillAPI.SetParam("organizationId", "xs:string")
hornbillAPI.SetParam("jobtitle", "xs:string")
hornbillAPI.SetParam("description", "xs:string")
hornbillAPI.SetParam("company", "xs:string")
hornbillAPI.SetParam("notes", "xs:string")
hornbillAPI.SetParam("country", "xs:string")
hornbillAPI.SetParam("region", "xs:string")
hornbillAPI.SetParam("language", "xs:string")
hornbillAPI.SetParam("timezone", "xs:string")
hornbillAPI.SetParam("status", "xs:int")
hornbillAPI.SetParam("owner", "xs:string")
hornbillAPI.SetParam("type", "xs:int")
hornbillAPI.SetParam("private", "xs:int")
hornbillAPI.SetParam("activityStreamId", "xs:string")
hornbillAPI.SetParam("custom_1", "xs:string")
hornbillAPI.SetParam("custom_2", "xs:string")
hornbillAPI.SetParam("custom_3", "xs:string")
hornbillAPI.SetParam("custom_4", "xs:string")
hornbillAPI.SetParam("custom_5", "xs:string")
hornbillAPI.SetParam("custom_6", "xs:string")
responseBody, apiError := hornbillAPI.Invoke("apps/com.hornbill.core/Contact", "add")
if apiError != nil {
fmt.Println(apiError)
return
}
fmt.Println(responseBody)
}
const endpoint = "https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact";
const payload = {
"@service": "apps/com.hornbill.core/Contact",
"@method": "add",
"params": {
"firstname": "xs:string",
"lastname": "xs:string",
"email1": "xs:string",
"email2": "xs:string",
"email3": "xs:string",
"tel1": "xs:string",
"tel2": "xs:string",
"tel3": "xs:string",
"organizationId": "xs:string",
"jobtitle": "xs:string",
"description": "xs:string",
"company": "xs:string",
"notes": "xs:string",
"country": "xs:string",
"region": "xs:string",
"language": "xs:string",
"timezone": "xs:string",
"status": 1,
"owner": "xs:string",
"type": 1,
"private": 1,
"activityStreamId": "xs:string",
"custom_1": "xs:string",
"custom_2": "xs:string",
"custom_3": "xs:string",
"custom_4": "xs:string",
"custom_5": "xs:string",
"custom_6": "xs:string"
}
};
fetch(endpoint, {
method: 'POST',
headers: {
"Authorization": "ESP-APIKEY yourHornbillAPIKey"
},
body: JSON.stringify(payload)
}).then(res => res.json())
.then(res => console.log(res));
const axios = require('axios');
const endpoint = "https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact";
const payload = {
"@service": "apps/com.hornbill.core/Contact",
"@method": "add",
"params": {
"firstname": "xs:string",
"lastname": "xs:string",
"email1": "xs:string",
"email2": "xs:string",
"email3": "xs:string",
"tel1": "xs:string",
"tel2": "xs:string",
"tel3": "xs:string",
"organizationId": "xs:string",
"jobtitle": "xs:string",
"description": "xs:string",
"company": "xs:string",
"notes": "xs:string",
"country": "xs:string",
"region": "xs:string",
"language": "xs:string",
"timezone": "xs:string",
"status": 1,
"owner": "xs:string",
"type": 1,
"private": 1,
"activityStreamId": "xs:string",
"custom_1": "xs:string",
"custom_2": "xs:string",
"custom_3": "xs:string",
"custom_4": "xs:string",
"custom_5": "xs:string",
"custom_6": "xs:string"
}
};
const axiosConfig = {
headers: {
"Authorization": "ESP-APIKEY yourHornbillAPIKey"
}
};
axios.post(endpoint, payload, axiosConfig)
.then((res) => {
console.log("RESPONSE RECEIVED: ", res);
})
.catch((err) => {
console.log("AXIOS ERROR: ", err);
})
$endpoint = "https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact";
$payload = (object) [
'@service' => 'apps/com.hornbill.core/Contact',
'@method' => 'add',
'params' => (object) [
'firstname' => 'xs:string',
'lastname' => 'xs:string',
'email1' => 'xs:string',
'email2' => 'xs:string',
'email3' => 'xs:string',
'tel1' => 'xs:string',
'tel2' => 'xs:string',
'tel3' => 'xs:string',
'organizationId' => 'xs:string',
'jobtitle' => 'xs:string',
'description' => 'xs:string',
'company' => 'xs:string',
'notes' => 'xs:string',
'country' => 'xs:string',
'region' => 'xs:string',
'language' => 'xs:string',
'timezone' => 'xs:string',
'status' => 'xs:int',
'owner' => 'xs:string',
'type' => 'xs:int',
'private' => 'xs:int',
'activityStreamId' => 'xs:string',
'custom_1' => 'xs:string',
'custom_2' => 'xs:string',
'custom_3' => 'xs:string',
'custom_4' => 'xs:string',
'custom_5' => 'xs:string',
'custom_6' => 'xs:string',
]
];
$headers = [
'Authorization: ESP-APIKEY yourHornbillAPIKey',
'Content-Type: application/json'
];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $endpoint);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;
$Endpoint = "https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact"
$Body = @{
"@service" = "apps/com.hornbill.core/Contact"
"@method" = "add"
params = @{
firstname = "xs:string"
lastname = "xs:string"
email1 = "xs:string"
email2 = "xs:string"
email3 = "xs:string"
tel1 = "xs:string"
tel2 = "xs:string"
tel3 = "xs:string"
organizationId = "xs:string"
jobtitle = "xs:string"
description = "xs:string"
company = "xs:string"
notes = "xs:string"
country = "xs:string"
region = "xs:string"
language = "xs:string"
timezone = "xs:string"
status = "xs:int"
owner = "xs:string"
type = "xs:int"
private = "xs:int"
activityStreamId = "xs:string"
custom_1 = "xs:string"
custom_2 = "xs:string"
custom_3 = "xs:string"
custom_4 = "xs:string"
custom_5 = "xs:string"
custom_6 = "xs:string"
}
}
$Header = @{
"Authorization" = "ESP-APIKEY yourHornbillAPIKey"
}
$Parameters = @{
Method = "POST"
Uri = $Endpoint
Headers = $Header
Body = ($Body | ConvertTo-Json)
ContentType = "application/json"
}
Invoke-RestMethod @Parameters
import requests
import json
endpoint = "https://api.hornbill.com/yourinstanceid/xmlmc/apps/com.hornbill.core/Contact"
headers = {
"Authorization": "ESP-APIKEY yourHornbillAPIKey"
}
payload={
"@service":"apps/com.hornbill.core/Contact",
"@method":"add",
"params":{
"firstname":"xs:string",
"lastname":"xs:string",
"email1":"xs:string",
"email2":"xs:string",
"email3":"xs:string",
"tel1":"xs:string",
"tel2":"xs:string",
"tel3":"xs:string",
"organizationId":"xs:string",
"jobtitle":"xs:string",
"description":"xs:string",
"company":"xs:string",
"notes":"xs:string",
"country":"xs:string",
"region":"xs:string",
"language":"xs:string",
"timezone":"xs:string",
"status":"xs:int",
"owner":"xs:string",
"type":"xs:int",
"private":"xs:int",
"activityStreamId":"xs:string",
"custom_1":"xs:string",
"custom_2":"xs:string",
"custom_3":"xs:string",
"custom_4":"xs:string",
"custom_5":"xs:string",
"custom_6":"xs:string",
},
}
response = requests.request("POST", endpoint, json=payload, headers=headers)
print(response.text)
- Version {{docApp.book.version}}
- Node {{docApp.node}} / {{docApp.build}}
In This Document