Search code examples
curlhighrise

High rise API giving a 'No first name' error when adding a person, even though its provided


I'm attempting to create a new person using HighRise's API:

curl -u xxxxxxx:X -XPOST -d '<?xml version="1.0" encoding="UTF-8"?>
<person>
    <first-name>Test</first-name>
    <last-name>Acct</last-name>
    <title>CEO</title>
    <company-name>Test inc</company-name>
    <contact-data>
        <email-addresses>
            <email-address>
                <address>[email protected]</address>
                <location>Home</location>
            </email-address>
        </email-addresses>
        <phone-numbers>
            <phone-number>
                <number>1111</number>
                <location>Home</location>
            </phone-number>
        </phone-numbers>
    </contact-data>
</person>' 'https://xxxxxx.highrisehq.com/people.xml'

However, this gives the following output:

<?xml version="1.0" encoding="UTF-8"?>
<errors>
  <error>First name  is missing. Contacts must have a name</error>
</errors>

I'm quite confused, as I seem to be following their API and providing the info as they expect it (as documented here).

Is this a bug in their API, or am I doing something wrong?


Solution

  • Usually it requires to add the Content-Type header with xml POST request. Add the following with your curl request.

    -H "Content-Type: application/xml"