-
Notifications
You must be signed in to change notification settings - Fork 1
highrise-java-api seems not working when trying to add a new Person #8
Description
Hi,
I cloned your java repository and try to do a call to create a new Person in my HighRise customer list.
Problem: Create Person does not work using java-api
Steps to reproduce:
-
Autenticate:
HighriseClient client = HighriseClient.create(baseUrl);
client.auth(username, password); -
Create Person:
Person newPerson = new Person();
newPerson.setFirstName(FIRSTNAME);
newPerson.setLastName(LASTNAME);
ContactData contact = new ContactData();
contact.setEMailAddresses(ImmutableList.of(new EMailAddress(EMAIL, "Work")));
newPerson.setContactData(contact);
PersonResource personResource = client.getResource(PersonResource.class);
person=personResource.create(newPerson);
Java Exception:
og4j: Adding appender named [consoleAppender] to category [root].
02 sept. 2015 15:21:14 DEBUG RestTemplate - Created GET request for "https://conztanz1.highrisehq.com/me.xml"
02 sept. 2015 15:21:14 DEBUG RestTemplate - Setting request Accept header to [application/json, application/xml, application/+json, text/xml]
02 sept. 2015 15:21:15 DEBUG RestTemplate - GET request for "https://conztanz1.highrisehq.com/me.xml" resulted in 200 (OK)
02 sept. 2015 15:21:15 DEBUG RestTemplate - Reading [org.nobel.highriseapi.entities.User] as "application/xml;charset=utf-8" using [org.nobel.highriseapi.mapper.SimpleXmlHttpMessageConverter@27bbf6b4]
02 sept. 2015 15:21:16 DEBUG RestTemplate - Created POST request for "https://conztanz1.highrisehq.com/people.xml"
02 sept. 2015 15:21:16 DEBUG RestTemplate - Setting request Accept header to [application/json, application/xml, application/+json, text/xml]
02 sept. 2015 15:21:16 DEBUG RestTemplate - Writing [org.nobel.highriseapi.entities.Person@447adfd] using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7defbf3c]
02 sept. 2015 15:21:16 WARN RestTemplate - POST request for "https://conztanz1.highrisehq.com/people.xml" resulted in 422 (Unprocessable Entity); invoking error handler
org.springframework.web.client.HttpClientErrorException: 422 Unprocessable Entity
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:537)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:493)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:326)
at org.nobel.highriseapi.resources.base.SpringRestTemplateRemoteEntityManager.createEntity(SpringRestTemplateRemoteEntityManager.java:47)
at org.nobel.highriseapi.resources.base.EntityResource$RemoteEntityAccessorWithCacheSupport.delegateCreateEntity(EntityResource.java:30)
at org.nobel.highriseapi.resources.base.EntityAccessorWithCacheSupport.createEntity(EntityAccessorWithCacheSupport.java:23)
at org.nobel.highriseapi.resources.base.EntityResource.create(EntityResource.java:98)
at com.conztanz.mediator.connect.crm.highrise.HighriseMediator.createTestPerson(HighriseMediator.java:241)
at com.conztanz.mediator.connect.crm.highrise.HighriseMediator.create(HighriseMediator.java:158)
at com.conztanz.mediator.connect.crm.highrise.HighriseMediator.main(HighriseMediator.java:93)
I intercept the POST call made to the https://conztanz1.highrisehq.com/people.xml service and I found that:
{
"id":null,
"name":"John Mikael Junior",
"companyName":"Company",
"avatarUrl":null,
"background":null,
"contactData":
{
"phoneNumbers":[],
"emailAddresses":[{"id":null,"address":"myteston@gmail.com","location":"Work"}]
},
"type":"Typee",
"tags":null,
"firstName":"John",
"lastName":"Mikael Junior",
"title":null,
"fullName":"John Mikael Junior",
"image":null
}
So I tried to call the service by hand using postman and I got the response:
Http status code: 422
Body:
First name is missing. Contacts must have a name
I saw that the last commit was made in january 2014... :(
Do you have a working new version of the highrise java api?
Thank you for your help.
Dom