Post

1 follower Follow
0
Avatar

Create/Update Note item via Rest API

In our organization, we create Note item for a Customer item or a Project Item. I'd like to know if I can create Note item via Rest API.

Below is a json message that I've tried to PUT to the Rest API at "https://api2.clarizen.com/v1.0/services/data/objects/note" but it does not seem to create the note... Does the Rest API support Note creation?

{

"PlainText": "A new note for customer via Rest API",

"AttachedTo": "/Customer/c78f2f04-ce88-4f59-ab26-cbbc68fd79b7",

"CreatedOn": "2014-09-15T17:05:41.6003660",

"CreatedBy":"/User/fb37be39-f634-4b20-b28d-0a3d3b825c5b"

}

Both customer and user id do exist on Clarizen. What have I done wrong? Please help. Thanks.

 

 

Michael Trang Answered

Please sign in to leave a comment.

2 comments

0
Avatar

First, always make sure you are reading back the error messages that the API returns (Just read back the response even if you fail with a 500 error).

This one probably fails because you are trying to update the CreatedOn and CreatedBy fields which are system fields. No need to provide them as they will be calculated for you.

 

Eyal Post 0 votes
Comment actions Permalink
0
Avatar

Hi Eyal,

That's a very good tip! By looking into the response even if it returns 500 error, it tells me the "PlainText" field is a read only field and can't be updated... I guess when a Note is added, the text should go into the Comment field and then the text with html stripped off goes into the PlainText field. However, how can we tell a Standard field is a read-only field?

By removing the CreatedOn and CreatedBy field and put the note text into the Comment field, it works!!, here is my modified json message:

{

"Comment": "<p>Another note for customer via Rest API<p>",

"AttachedTo":"/Customer/c78f2f04-ce88-4f59-ab26-cbbc68fd79b7"

}

Thanks very much.

 

Michael Trang 0 votes
Comment actions Permalink