Create Contact for Customer
1 min
POST
https://api.nue.io/customers/{customerId}/contacts
Path Parameters
- customerIdstringrequiredDescription
Body Parameters
- bodyobject[]required
- firstNamestringrequiredDescriptionMax Length40
- lastNamestringrequiredDescriptionMax Length80
- namestringrequiredDescriptionMax Length255
- birthdaystring<date>DescriptionFormatdate
- billingCitystringDescription
- billingCountrystringDescription
- billingPostalCodestringDescription
- billingStatestringDescription
- billingStreetstringDescription
- emailstring<email>requiredDescriptionFormatemail
- middleNamestringDescriptionMax Length40
- mobilePhonestringDescription
- phonestringDescription
- shippingCitystringDescription
- shippingCountrystringDescription
- shippingPostalCodestringDescription
- shippingStatestringDescription
- shippingStreetstringDescription
- suffixstringDescriptionMax Length40
- titlestringDescription
Responses
201
- object
- statusstring<SUCCESS | PARTIAL_SUCCESS | FAILURE>DescriptionAllowedSUCCESSPARTIAL_SUCCESSFAILURE
- dataobject[]Description
- billingCitystringDescription
- billingCountrystringDescription
- billingPostalCodestringDescription
- billingStatestringDescription
- billingStreetstringDescription
- birthdaystring<date>DescriptionFormatdate
- createdByIdstringDescription
- createdDatestring<date-time>DescriptionFormatdate-time
- customerIdstringDescription
- emailstring<email>DescriptionFormatemail
- firstNamestringDescription
- idstringDescription
- lastModifiedByIdstringDescription
- lastModifiedDatestring<date-time>DescriptionFormatdate-time
- lastNamestringDescription
- middleNamestringDescription
- mobilePhonestringDescription
- namestringDescription
- phonestringDescription
- shippingCitystringDescription
- shippingCountrystringDescription
- shippingPostalCodestringDescription
- shippingStatestringDescription
- shippingStreetstringDescription
- suffixstringDescription
- titlestringDescription
- warningsobject[]Description
- codestringDescription
- messagestringDescription
400
401
curl
curl --request POST \
--url https://api.nue.io/customers/{customerId}/contacts \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '[
{
"firstName": "",
"lastName": "",
"name": "",
"email": ""
}
]'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify([
{
"firstName": "",
"lastName": "",
"name": "",
"email": ""
}
]);
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.nue.io/customers/{customerId}/contacts", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.nue.io/customers/{customerId}/contacts")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump([
{
"firstName": "",
"lastName": "",
"name": "",
"email": ""
}
])
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.nue.io/customers/{customerId}/contacts"
payload = json.dumps([
{
"firstName": "",
"lastName": "",
"name": "",
"email": ""
}
])
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
201
// Contacts created successfully
{
"status": "",
"data": [
{
"billingCity": "",
"billingCountry": "",
"billingPostalCode": "",
"billingState": "",
"billingStreet": "",
"birthday": "",
"createdById": "",
"createdDate": "",
"customerId": "",
"email": "",
"firstName": "",
"id": "",
"lastModifiedById": "",
"lastModifiedDate": "",
"lastName": "",
"middleName": "",
"mobilePhone": "",
"name": "",
"phone": "",
"shippingCity": "",
"shippingCountry": "",
"shippingPostalCode": "",
"shippingState": "",
"shippingStreet": "",
"suffix": "",
"title": ""
}
],
"warnings": [
{
"code": "",
"message": ""
}
]
}400
// Bad Request - The request was malformed or contained invalid parameters
401
// Unauthorized - Authentication information is missing or invalid