Here's a curl command to set a company_id in a contact. I run this from a Windows Shell. It's pretty much extracted from the online reference example "Update a Contact
"
curl -v -u myAPIkey-H 'Content-Type: application/json' -X PUT -d "{"company_id":33000299559}" "https://ntiaudiohelpdesk.freshdesk.com/api/v2/contacts/33002370286"
The double quotes seem to be necessary, I tried several variations tough...
Here's the response I get:
-------------------------------------------------------------------------------------------------------
* Could not resolve host: application
* Closing connection 0
curl: (6) Could not resolve host: application
* Trying 52.20.151.223...
* TCP_NODELAY set
* Connected to ntiaudiohelpdesk.freshdesk.com (52.20.151.223) port 443 (#1)
* schannel: SSL/TLS connection with ntiaudiohelpdesk.freshdesk.com port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 195 bytes...
* schannel: sent initial handshake data: sent 195 bytes
* schannel: SSL/TLS connection with ntiaudiohelpdesk.freshdesk.com port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with ntiaudiohelpdesk.freshdesk.com port 443 (step 2/3)
* schannel: encrypted data got 3061
* schannel: encrypted data buffer: offset 3061 length 4096
* schannel: sending next handshake data: sending 126 bytes...
* schannel: SSL/TLS connection with ntiaudiohelpdesk.freshdesk.com port 443 (step 2/3)
* schannel: encrypted data got 51
* schannel: encrypted data buffer: offset 51 length 4096
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with ntiaudiohelpdesk.freshdesk.com port 443 (step 3/3)
* schannel: stored credential handle in session cache
* Server auth using Basic with user 'xxxxxxxxxxxxxxxx'
> PUT /api/v2/contacts/33002370286 HTTP/1.1
> Host: ntiaudiohelpdesk.freshdesk.com
> Authorization: Basic bzJYOU9UbzZHVmswb3RGQXJNNm46WA==
> User-Agent: curl/7.60.0
> Accept: */*
> Content-Length: 24
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 24 out of 24 bytes
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 566
* schannel: encrypted data buffer: offset 566 length 103424
* schannel: decrypted data length: 537
* schannel: decrypted data added: 537
* schannel: decrypted data cached: offset 537 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 537 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 537
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 415 Unsupported Media Type
< Content-Type: application/json
< Date: Wed, 13 Jun 2018 09:28:53 GMT
< Status: 415 Unsupported Media Type
< X-Rack-Cache: invalidate, pass
< X-RateLimit-Remaining: 2895
< X-RateLimit-Total: 3000
< X-RateLimit-Used-CurrentRequest: 1
< X-Request-Id: baef3c4220a8b9de20419d8bd05085a4
< X-XSS-Protection: 1; mode=block
< Content-Length: 145
< Connection: keep-alive
<
{"code":"invalid_content_type","message":"Content-Type header is set to application/x-www-form-urlencoded. It should be set to application/json"}* Connection #1 to host ntiaudiohelpdesk.freshdesk.com left intact
-------------------------------------------------------------------------------------------------------
I have similar commands that query a contact working just fine. It's the PUT type that is bugging me....
Thanks for your help,
Greg