REST API Usage and getting cust_notes?

  • 30 January 2017
  • 5 replies
  • 160 views

Hello!

I am using the REST API (and formatted JSON) to get ticket data. I am able to log in, create tickets, and get ticket data (certain fields, filtering, etc all seem to work just fine).

I'm running into a problem with cust_notes though. I can't seem to get the notes from the ticket through a http/get request.

When I include the cust_notes field, it is just empty:

{"id":"136079","canUpdate":true,"canDelete":false,"canArchive":false,"info":[{"key":"update_time","value":1485792408000,"keyCaption":"Modify time","valueCaption":"01/30/2017 10:06:48 AM"},{"key":"cust_notes","value":"","keyCaption":"SR Custom Notes","valueCaption":""},{"key":"request_user","value":1280,"keyCaption":"Request user","valueCaption":"Cliff Adair"},{"key":"description","value":"test","keyCaption":"Description","valueCaption":"test"},{"key":"title","value":"DEFAULT","keyCaption":"Subject","valueCaption":"DEFAULT"},{"key":"status","value":1,"keyCaption":"Status","valueCaption":"New"}]}]

regardless if it is or isn't empty. In this case there are two notes:

Cliff Adair (01/30/2017 10:03:15):
test
=============================
Cliff Adair (01/30/2017 10:03:09):
test

Is there a to get notes other than through a normal JSON http/get?

5 replies

It's amazing what posting on a board does - I randomly found some of the answer, which led me to the whole answer. And possibly a bug??

the key is 'notes' not 'cust_notes'.

This:
https://xxx.sysaidit.com/api/v1/sr/136079?fields=status,title,description,request_user,update_time,notes&limit=2&sort=id&dir=desc

Will properly return the notes, in an array.

This:
https://bridgemanfoods.sysaidit.com/api/v1/sr/?fields=status,title,description,request_user,update_time,notes&limit=2&sort=id&dir=desc

Will not. Very odd. But, it answers my question, so I'll have to do a bit of re-coding.
trying to follow your post, were you able to find the notes field in the rest api?
Hey GD, the post was made several years ago, but it's still that way:

You can only get the notes for a single ticket (first link), not for several at once (second link).

I wouldn't have expected this behavior either.
GD -

I did indeed. As Tamarah said, you can only get notes for a single ticket at a time. So I pulled my ticket list based on criteria (such as our status) and then looped through each ID to get the data & add to a 2D array.
thanks for the reply. didnt notice that difference. i'll add similar logic to loop thru the list.

/api/v1/sr/136079?fields=s...notes&limit=2&sort=id&dir=desc
/api/v1/sr/?fie...notes&limit=2&sort=id&dir=desc

Reply