2015-11-02 62 views
0

我试图创建一个使用高层的API一个新的人:高层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' 

然而,这给出了下面的输出:

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

我很困惑,因为我似乎在跟随他们的API和他们期望它(如记录here)提供的信息。

这是他们的API中的错误,还是我做错了什么?

回答

1

通常需要在xml POST请求中添加Content-Type标题。添加以下curl请求。

-H "Content-Type: application/xml" 
+0

谢谢:) --- –

相关问题