Update Ticket and Associate Ticket with User Asset

Hello, Nacho here! New to the forum, but been using the software for almost a year now. I have been cracking my head at how to properly update a ticket with the proper asset using the Freshservice API. In our company, all users have exactly one laptop (i.e. one asset per user) and we are crafting a custom app that automatically assigns the asset to the user’s ticket. I can’t seem to update the “assoc_asset_id” field via the update ticket, nor using the “Associate a CI/Asset to a Ticket” API. Any help?

Hello @Nacho,

Welcome to the community! :tada: We are happy to have you here to get help and contribute to the community. :slight_smile:

What is the error or response (for that field) returned upon using both Update ticket API and “Associate a CI/Asset to a ticket API”?

So when I run this curl command:

curl -u [my api key]:test -H "Content-Type: application/json" -X PUT -d '{ "helpdesk_ticket": { "assoc_asset_id": 10000806383}' https://help[dot]essenceglobal[dot]com/helpdesk/tickets/16766.json

I get this response:

https://help[dot]essenceglobal[dot]com/helpdesk/tickets/16766.json

  • Trying 34.227.128.87…
  • TCP_NODELAY set
  • Connected to help[dot]essenceglobal[dot]com (34.227.128.87) port 443 (#0)
  • ALPN, offering h2
  • ALPN, offering http/1.1
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt
    CApath: /etc/ssl/certs
  • TLSv1.3 (OUT), TLS handshake, Client hello (1):
  • TLSv1.3 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  • ALPN, server accepted to use h2
  • Server certificate:
  • subject: CN=fsus-17.freshservice[dot]com
  • start date: Jun 2 06:42:52 2020 GMT
  • expire date: Aug 31 06:42:52 2020 GMT
  • subjectAltName: host “help[dot]essenceglobal[dot]com” matched cert’s “help[dot]essenceglobal[dot]com”
  • issuer: C=US; O=Let’s Encrypt; CN=Let’s Encrypt Authority X3
  • SSL certificate verify ok.
  • Using HTTP2, server supports multi-use
  • Connection state changed (HTTP/2 confirmed)
  • Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
  • Server auth using Basic with user ‘*************************’
  • Using Stream ID: 1 (easy handle 0x7fffcd9a9580)

PUT /helpdesk/tickets/16766.json HTTP/2
Host: help[dot]essenceglobal[dot]com
Authorization: Basic **************
User-Agent: curl/7.58.0
Accept: /
Content-Type: application/json
Content-Length: 54

  • Connection state changed (MAX_CONCURRENT_STREAMS updated)!
  • We are completely uploaded and fine
    < HTTP/2 200
    < date: Tue, 02 Jun 2020 19:10:42 GMT
    < content-type: application/json; charset=utf-8
    < status: 200 OK
    < cache-control: no-cache, no-store, max-age=0, must-revalidate
    < strict-transport-security: max-age=31536000;
    < pragma: no-cache
    < x-xss-protection: 1; mode=block
    < x-request-id: *********************
    < x-runtime: 0.033058
    < x-frame-options: SAMEORIGIN
    < x-content-type-options: nosniff
    < expires: Fri, 01 Jan 1990 00:00:00 GMT
    < set-cookie: helpdesk_node_session=**********************; path=/; secure; HttpOnly
    < x-envoy-upstream-service-time: 36
    <
  • Connection #0 to host help[dot]essenceglobal[dot]com left intact
    {“errors”:[“Error while updating ticket properties”]}

Am I not able to update “assoc_asset_id” this way?

@Nacho I will get it discussed with the product team and post updates on this thread on the behavior of this API and workaround for your request to associate ticket and user asset.

@Raviraj Thank you kindly. We are currently using the stable v1 API. I have read the v2 documentation and do see there are two options to update assets and one will be deprecated (or already is). I’d like to stick to the v1 API if possible. Thank you again for looking into this!

@Nacho Try the following format to associate the asset. Request data has been changed from your cURL request.

curl -u [my api key]:test -H "Content-Type: application/json" -X PUT -d ' { "helpdesk_ticket": {}, "associate_ci":{"assoc_asset_id":10000806383} } ' https://help[dot]essenceglobal[dot]com/helpdesk/tickets/16766.json 

Please confirm if it works.

Hi @Nacho,

My previous suggestion is for V1 API.

The asset association has a specific format which needs to be given while creating/updating a ticket. The hash should be provided to identify assets by serial number, name, and user, then the same is associated with the ticket created/updated.

V1 API is also accepting the hash-based associate ci params, but it will be deprecated. It is better to use V2 API structure.

In the Create Ticket API, in the Create Ticket with assets, the properties can be found.

For v1 API, the association can be done with the following parameters:
“associate_ci” : “{serial_no => <asset_serial_number>,name=><asset_name>,user=><user_name>}”

And for v2 API, it can be done using this:
“assets”: {[<display_id1>,<display_id2>]}

This topic was automatically closed after 14 days. New replies are no longer allowed.