Add a new contact if it not exists. To call this, you need to have the right to add contact of 090300.
curl -X POST "https://api.example.com/restapi/v1/contacts" \
-H "Content-Type: application/json" \
-d '{
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"email": "user@example.com",
"company": "example_string",
"department": "example_string",
"position": "example_string",
"isPostOfficeBox": 42,
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"phone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"fax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"mobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"categoryId": 123,
"commTemplateId": 123,
"externalNewsletter": "example_string",
"externalNewsletterId": "example_string"
}'
import requests
import json
url = "https://api.example.com/restapi/v1/contacts"
headers = {
"Content-Type": "application/json"
}
data = {
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"email": "user@example.com",
"company": "example_string",
"department": "example_string",
"position": "example_string",
"isPostOfficeBox": 42,
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"phone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"fax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"mobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"categoryId": 123,
"commTemplateId": 123,
"externalNewsletter": "example_string",
"externalNewsletterId": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.example.com/restapi/v1/contacts", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"email": "user@example.com",
"company": "example_string",
"department": "example_string",
"position": "example_string",
"isPostOfficeBox": 42,
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"phone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"fax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"mobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"categoryId": 123,
"commTemplateId": 123,
"externalNewsletter": "example_string",
"externalNewsletterId": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"email": "user@example.com",
"company": "example_string",
"department": "example_string",
"position": "example_string",
"isPostOfficeBox": 42,
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"phone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"fax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"mobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"categoryId": 123,
"commTemplateId": 123,
"externalNewsletter": "example_string",
"externalNewsletterId": "example_string"
}`)
req, err := http.NewRequest("POST", "https://api.example.com/restapi/v1/contacts", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.example.com/restapi/v1/contacts')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request.body = '{
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"email": "user@example.com",
"company": "example_string",
"department": "example_string",
"position": "example_string",
"isPostOfficeBox": 42,
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"phone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"fax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"mobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"categoryId": 123,
"commTemplateId": 123,
"externalNewsletter": "example_string",
"externalNewsletterId": "example_string"
}'
response = http.request(request)
puts response.body
[
{
"id": 123,
"contactType": "example_string",
"salutation": "mr",
"title": "example_string",
"firstName": "John Doe",
"lastName": "John Doe",
"company": "example_string",
"companyId": 123,
"email": "user@example.com",
"website": "example_string",
"contactCategoriesId": [
123
],
"defaultAddress": [
{
"id": 123,
"addressType": 42,
"parentContact": "example_string",
"parentContactId": 123,
"isDefault": true,
"position": "example_string",
"department": "example_string",
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"emails": [
{
"id": 123,
"email": "user@example.com"
}
],
"phones": [
{
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
}
]
}
],
"defaultPhone": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"defaultFax": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"defaultMobile": {
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
},
"allAddress": [
{
"id": 123,
"addressType": 42,
"parentContact": "example_string",
"parentContactId": 123,
"isDefault": true,
"position": "example_string",
"department": "example_string",
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"emails": [
{
"id": 123,
"email": "user@example.com"
}
],
"phones": [
{
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
}
]
}
],
"invoiceAddress": [
{
"id": 123,
"addressType": 42,
"parentContact": "example_string",
"parentContactId": 123,
"isDefault": true,
"position": "example_string",
"department": "example_string",
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"emails": [
{
"id": 123,
"email": "user@example.com"
}
],
"phones": [
{
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
}
]
}
],
"invoiceSendAddress": [
{
"id": 123,
"addressType": 42,
"parentContact": "example_string",
"parentContactId": 123,
"isDefault": true,
"position": "example_string",
"department": "example_string",
"street": "example_string",
"houseNumber": "example_string",
"addition": "example_string",
"zip": "example_string",
"city": "New York",
"state": "example_string",
"country": "USA",
"emails": [
{
"id": 123,
"email": "user@example.com"
}
],
"phones": [
{
"id": 123,
"type": "example_string",
"countryCode": "USA",
"areaCode": "example_string",
"number": "example_string"
}
]
}
],
"extNewsletter": [
[
{
"cmain_id": 123,
"ext_type": "example_string",
"ext_id": "example_string",
"is_active": 42,
"ext_opt_in": 42,
"ext_opt_in_executed": 42
}
]
]
}
]
{
"error": "Error",
"message": "Method not allowed",
"code": 405
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
POST
/contacts
POST
Base URLstring
Target server for requests. Edit to use your own host.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
salutationstring
Options: mr, ms
emailstring
RequiredYou must give an valid email.
Request Preview
Response
Response will appear here after sending the request
Body
application/json
salutationstring
Allowed values:
mrmsemailstring
RequiredYou must give an valid email.
Responses
idinteger
contactTypestring
salutationstring
Allowed values:
mrmstitlestring
firstNamestring
lastNamestring
companystring
companyIdinteger
emailstring
websitestring
contactCategoriesIdinteger[]
defaultAddressarray
defaultPhoneobject
defaultFaxobject
defaultMobileobject
allAddressarray
invoiceAddressarray
invoiceSendAddressarray
extNewsletterarray[]
Was this page helpful?