Updating a custom property on a Ticket via API

SOLVE
Highlighted
Occasional Contributor

I'm trying to add/update value to a custom property on a ticket via the

PUT /crm-objects/v1/objects/tickets/:id endpoint.

  • I have created the property as a single line text entry via the Property Editor GUI.
  • I get a HTTP/1.1 415 Unsupported Media Type response no matter what I try to put in the JSON body.  
  • The sample code at https://developers.hubspot.com/docs/methods/tickets/update-ticket if used with my API key also returns a 415 response.
  • I am able to access the api for other tickets endpoints using my API key.

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
HubSpot Moderator

Our documentation actually do mention to use internal name of the property (in the paragraph of description at the top). But I see how it could be clearer if we ensure the consistency of the language i.e. in the Optional parameters table the description does not state internal name. I'll work with the team on this, thank you for the feedback! 

Reply
0 Upvotes
6 Replies
HubSpot Moderator

Hi @ChipCoons , can you verify that the content-type is being set to application/json correctly? We’d normally only return that 415 error if there was a problem with that content-type header, otherwise you’d get some other 4xx error if there was some other problem with the request. 

Reply
0 Upvotes
Occasional Contributor

Good tip.  I forced content-type, but now am getting a 400 error that the custom property on the ticket does not exist.

 

Request Headers & Body:

Accept: */* Accept-Encoding: gzip, deflate 
Content-Type: application/json 
Accept-Language: en-us

[{
"name": "upload_URL",
"value": "https://scandimension.net"
}]

Response Body:

{
    "validationResults": [
        {
            "isValid": false,
            "message": "Property \"upload_URL\" does not exist",
            "error": "PROPERTY_DOESNT_EXIST",
            "name": "upload_URL"
        }
    ],
    "status": "error",
    "message": "Property values were not valid"
}
But the property definietly exists, since I can manual set a value to it via the GUI.
Reply
0 Upvotes
HubSpot Moderator

Thank you for providing the request headers and body. Checking on the ticket property in your portal, the internal name of the property is upload_url. You would need to match exactly the internal name of the property in the request body, including capitalization. Let me know if changing that works for you.

Reply
0 Upvotes
Occasional Contributor

Thanks, that worked.

 

Might I suggest the documentation explictily state that the internal property name must be used?  

 

I used the propery name displayed within the ticket interface for properties and did not pay much attention to the internal name when I created the property.  The name I entered had capital "URL" but that is only the lable.

 

 

Reply
0 Upvotes
HubSpot Moderator

Our documentation actually do mention to use internal name of the property (in the paragraph of description at the top). But I see how it could be clearer if we ensure the consistency of the language i.e. in the Optional parameters table the description does not state internal name. I'll work with the team on this, thank you for the feedback! 

Reply
0 Upvotes
HubSpot Employee

Hello,

 

Could you pleae proide us internal keys for all the properties for Ticket .I am trying to update Owner, could not find any where the internel key for Owner and couple other properties of ticket. 

Reply
0 Upvotes