0

Trying to use the highrise api to create people. So far I am half successful in that I can create a person and add a first name,last name, email, and phone number. However when I try and add an address, the data is not saved. Same thing for multiple phone numbers, ie Work, Home, etc. Here is an example of the data that is being send in my post

     <person>
        <first-name>John</first-name>
        <last-name>Doe</last-name>
        <title>CEO</title>
        <company-name>Doe Inc.</company-name>
        <background>A popular guy for random data</background>
        <linkedin_url>http://us.linkedin.com/in/john-doe</linkedin_url>
        <contact-data>
            <email-addresses>
                <email-address>
                    <address>john.doe@example.com</address>
                    <location>Work</location>
                </email-address>
            </email-addresses>
            <phone-numbers type="array">
                <phone-number>
                    <number>555-555-5555</number>
                    <location>Work</location>
                </phone-number>
                <phone-number>
                    <number>555-666-6666</number>
                    <location>Home</location>
                </phone-number>
            </phone-numbers>
        </contact-data>
    </person>

Am I missing something? For some background, I'm using node, turning the data from json into xml using an npm package. This is how the xml looks as its going out to highrise

Here is a sample of the json I'm using

{
  "person": {
    "first-name": "John",
    "last-name": "Doe",
    "title": "CEO",
    "company-name": "Doe Inc.",
    "background": "A popular guy for random data",
    "linkedin_url": "http://us.linkedin.com/in/john-doe",
    "contact-data": {
      "email-addresses": {
        "email-address": {
          "address": "john.doe@example.com",
          "location": "Work"
        }
      },
      "phone-numbers": {
        "-type": "array",
        "phone-number": [
          {
            "number": "555-555-5555",
            "location": "Work"
          },
          {
            "number": "555-666-6666",
            "location": "Home"
          }
        ]
      }
    }
  }
}

Ive tried using the type="array" and without

ceckenrode
  • 4,543
  • 7
  • 28
  • 48
  • 1
    Do you use POST or PUT method for updating? – Molda Jun 14 '16 at 06:51
  • Used Post. currently using the node-highrise-api for this which turns my json into this xml, and then does a POST. It creates customers no problem. The issue is when I want to add an address or if I want to add more than one phone number or email. For phone numbers and emails, it just takes whatever the last one on the list is, for addresses, nothing – ceckenrode Jun 14 '16 at 13:39
  • 1
    I think that addresses(and other arrays) should have attribute `type="array"` Can you show the json you are using? – Molda Jun 14 '16 at 13:50
  • 1
    Also as you can see in your xml your street is in *address* tag which is wrong it should be `streetname` and the address should be in `
    ` tag
    – Molda Jun 14 '16 at 13:52
  • updated my question with some sample json, thanks – ceckenrode Jun 15 '16 at 15:08
  • 1
    I think that correct json would look like this https://gist.github.com/molda/8ae74c2c59d4df5690fd18e3fafb20b9 **BUT there seems to be a bug in `to_xml` function** so it wont work. Error is `TypeError: value.get_name is not a function` since the get_name function is not defined. – Molda Jun 15 '16 at 15:41
  • This is the conclusion I've started to come to, thanks so much for your help – ceckenrode Jun 15 '16 at 16:40

0 Answers0