Forums/Product news and updates/API updates

Upcoming API Change: Improvements regarding attachments and user permissions

Steven Yan
posted this on January 23, 2012 11:11

We would like to make our API consumers aware of upcoming API additions planned for Thursday, January 26th during our weekly deploy.  As these are new sub-resources in our API, they should not affect existing API clients.

Attachments available in entries

If you access Zendesk forum entries via the API, you will now be able to access the attachment resources on entries and posts:

For example:

> curl https://yourdomain.zendesk.com/entries/20000061-testing-image-uploa...

<?xml version="1.0" encoding="UTF-8"?>
<entry>
  ...

  <attachments type="array">
    <attachment>
      <created-at type="datetime">2012-01-23T09:44:06-08:00</created-at>
      <id type="integer">20000547</id>
      <is-public type="boolean">true</is-public>
      <url>https://yourdomain.zendesk.com/attachments/token/bngjeuenqqkaslq</url>

    </attachment>
  </attachments>
</entry>

 

The same is available on posts:

> curl https://yourdomain.zendesk.com/entries/20000061-testing-image-uploa...
<?xml version="1.0" encoding="UTF-8"?>
<posts type="array" count="1">
  <post>
    ...
    <attachments type="array">
      <attachment>
        <id type="integer">20000557</id>
        <is-public type="boolean">false</is-public>
        <url>https://yourdomain.zendesk.com/attachments/token/bngjeuenqqkaslq</url>
      </attachment>
    </attachments>
  </post>
</posts>

 

Attachments available in XML exports for forum entries

If you use our XML export to access forum entries, you will now be able to access the attachments in the exported entries.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<entries report_date="20120123">
  <entry>
    <attachments type="array">
      <attachment>
        <id type="integer">20000547</id>
        <is-public type="boolean">true</is-public>
        <url>https://yourdomain.zendesk.com/attachments/token/bngjeuenqqkaslq</url>
      </attachment>
    </attachments>
  </entry>
</entries> 

 

Access to roles and permissions

Our Enterprise customers can now read the permission set on a user record as it relates to a custom role.  For more information about setting roles on users, see our users API documentation.

> curl https://yourdomain.zendesk.com/users/12345.xml
<?xml version="1.0" encoding="UTF-8"?>
<user>
  ...
  <custom_role_id>8847</custom_role_id>
</user> 

 

Comments

User photo
David Kakon
telgo

Hi Steve

 

Im trying to create a USER using the API whenever a CONTACT is created in my SALESFORCE account. I would need at least a PHONE field (at best 2 cell + office).

 

I dont see this in the API documentation, can you help?

 

Thanks

David

February 26, 2012 19:55
User photo
Steven Yan
Product Manager

Hi David, to clarify you are trying to create a user and set a phone number on it at the same time?  

Here's an example:

curl -u user@domain.com:password https://yourdomain.zendesk.com/users.json -X POST -H "Content-Type:application/json" -d '{"user":{"name":"OH HAI","email":"steven@blah.com","phone":"5555555555"}}'


{"name":"OH HAI","locale_id":null,"uses_12_hour_clock":false,"openid_url":null,"created_at":"2012/02/27 21:32:59 -0800","last_login":null,"details":null,"updated_at":"2012/02/27 21:32:59 -0800","notes":null,"external_id":null,"restriction_id":4,"id":170658017,"is_verified":false,"custom_role_id":null,"phone":"5555555555","is_active":true,"time_zone":"Eastern Time (US & Canada)","roles":0,"organization_id":null,"photo_url":"https://yourdomain.zendesk.com/images/types/user_sm.png","email":"s...}

 

February 27, 2012 21:34
User photo
Van

Steven, my need is similar -- on an incoming call, I have the Caller ID -- I want to create a user with that caller ID -- or if a user exists with that caller ID already to open that record

To get started I am happy just to create the record -- trying to follow this example, but I'm getting errors

curl -k -u agentemail:agentpassword https://company.zendesk.com/users.json -X POST -H "Content-Type:application/json" -d '{"user":{"name":"Unassigned","email":"unassigned@company.com","phone":"15555555555"}}'

the error I get is that the server cannot parse JSON

am I making an error in the syntax

July 08, 2012 14:55
User photo
Steven Yan
Product Manager

Hi Van, I'm unable to reproduce the JSON parsing error that you are seeing if I replace the password and URL with my own.  Your request looks perfectly fine.  If it's still not working for you, please submit a support ticket with the exact curl request you're making and we can help you out.  

Also, please note that you should start to adhere to API v2, details can be found here: http://developer.zendesk.com

July 08, 2012 15:16
User photo
Simon
billomat

I'm missing the attachment url when I get the entries via json. In the XML it is included.

July 18, 2012 05:54
User photo
Steven Yan
Product Manager

Hi Simon, are you talking about API v2?  If so, we are putting in a fix for this.

July 18, 2012 14:16