Upsert Does Not Insert

Upsert Does Not Insert

So we're following the upsert documentation from https://www.zoho.com/crm/help/api/v2/#ra-insert-or-update. This does not work as expected.

Consider the following INSERT operation:
  1. curl -v -H 'Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2' https://www.zohoapis.com/crm/v2/Accounts -d '{"data":[{"id":null,"Owner":{"id":"3297614000000156188"},"Description":null,"Account_Name":"Blergh","Phone":null,"Account_Number":null,"Account_Type":null,"Ownership":null,"Industry":null,"Employees":null,"Annual_Revenue":null,"Created_By":{"id":"3297614000000156188"},"Billing_Street":"123 fake street","Billing_City":"Seattle","Billing_State":"Bengo","Billing_Country":"Angola"}]}'
  2. * Trying 216.52.73.111...
  3. * TCP_NODELAY set
  4. * Connected to www.zohoapis.com (216.52.73.111) port 443 (#0)
  5. * ALPN, offering h2
  6. * ALPN, offering http/1.1
  7. * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  8. * successfully set certificate verify locations:
  9. * CAfile: /etc/ssl/cert.pem
  10. CApath: none
  11. * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  12. * TLSv1.2 (IN), TLS handshake, Server hello (2):
  13. * TLSv1.2 (IN), TLS handshake, Certificate (11):
  14. * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  15. * TLSv1.2 (IN), TLS handshake, Server finished (14):
  16. * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  17. * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  18. * TLSv1.2 (OUT), TLS handshake, Finished (20):
  19. * TLSv1.2 (IN), TLS change cipher, Client hello (1):
  20. * TLSv1.2 (IN), TLS handshake, Finished (20):
  21. * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  22. * ALPN, server accepted to use http/1.1
  23. * Server certificate:
  24. * subject: OU=Domain Control Validated; OU=Hosted by ZOHO Corporation Private Limited; OU=PositiveSSL Multi-Domain
  25. * start date: Jan 17 00:00:00 2018 GMT
  26. * expire date: Jan 17 23:59:59 2020 GMT
  27. * subjectAltName: host "www.zohoapis.com" matched cert's "*.zohoapis.com"
  28. * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
  29. * SSL certificate verify ok.
  30. > POST /crm/v2/Accounts HTTP/1.1
  31. > Host: www.zohoapis.com
  32. > User-Agent: curl/7.54.0
  33. > Accept: */*
  34. > Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2
  35. > Content-Length: 382
  36. > Content-Type: application/x-www-form-urlencoded
  37. >
  38. * upload completely sent off: 382 out of 382 bytes
  39. < HTTP/1.1 201 Created
  40. < Server: ZGS
  41. < Date: Mon, 18 Jun 2018 17:37:09 GMT
  42. < Content-Type: application/json;charset=utf-8
  43. < Content-Length: 330
  44. < Connection: keep-alive
  45. < Set-Cookie: 6726760df9=977c139eaf067d0fc45d7a9eefc71296; Path=/
  46. < Set-Cookie: crmcsr=79ea0029-6331-40de-88dd-4567dc6c5d05; Path=/; Secure
  47. < X-Frame-Options: SAMEORIGIN
  48. < X-Content-Type-Options: nosniff
  49. < X-XSS-Protection: 1
  50. < Pragma: no-cache
  51. < Cache-Control: no-store, no-cache, must-revalidate, private
  52. < Expires: Thu, 01 Jan 1970 00:00:00 GMT
  53. < clientVersion: 1655147
  54. < Content-Disposition: attachment; filename=response.json
  55. < X-ACCESSTOKEN-RESET: 2018-06-18T11:39:39-07:00
  56. < X-RATELIMIT-RESET: 1529343653969
  57. < X-RATELIMIT-REMAINING: 99
  58. < X-RATELIMIT-LIMIT: 100
  59. < Strict-Transport-Security: max-age=15768000
  60. <
  61. * Connection #0 to host www.zohoapis.com left intact
  62. {"data":[{"code":"SUCCESS","details":{"Modified_Time":"2018-06-18T10:39:54-07:00","Modified_By":{"name":"Alden Prudent","id":"3297614000000155021"},"Created_Time":"2018-06-18T10:39:54-07:00","id":"3297614000000279002","Created_By":{"name":"Alden Prudent","id":"3297614000000155021"}},"message":"record added","status":"success"}]}

and now the UPSERT:

  1. curl -v -H 'Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2' https://www.zohoapis.com/crm/v2/Accounts/upsert -d '{"data":[{"id":null,"Owner":{"id":"3297614000000156188"},"Description":null,"Account_Name":"Upsert Fails","Phone":null,"Account_Number":null,"Account_Type":null,"Ownership":null,"Industry":null,"Employees":null,"Annual_Revenue":null,"Created_By":{"id":"3297614000000156188"},"Billing_Street":"123 fake street","Billing_City":"Seattle","Billing_State":"Bengo","Billing_Country":"Angola"}]}'
  2. * Trying 216.52.73.111...
  3. * TCP_NODELAY set
  4. * Connected to www.zohoapis.com (216.52.73.111) port 443 (#0)
  5. * ALPN, offering h2
  6. * ALPN, offering http/1.1
  7. * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  8. * successfully set certificate verify locations:
  9. * CAfile: /etc/ssl/cert.pem
  10. CApath: none
  11. * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  12. * TLSv1.2 (IN), TLS handshake, Server hello (2):
  13. * TLSv1.2 (IN), TLS handshake, Certificate (11):
  14. * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  15. * TLSv1.2 (IN), TLS handshake, Server finished (14):
  16. * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  17. * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  18. * TLSv1.2 (OUT), TLS handshake, Finished (20):
  19. * TLSv1.2 (IN), TLS change cipher, Client hello (1):
  20. * TLSv1.2 (IN), TLS handshake, Finished (20):
  21. * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  22. * ALPN, server accepted to use http/1.1
  23. * Server certificate:
  24. * subject: OU=Domain Control Validated; OU=Hosted by ZOHO Corporation Private Limited; OU=PositiveSSL Multi-Domain
  25. * start date: Jan 17 00:00:00 2018 GMT
  26. * expire date: Jan 17 23:59:59 2020 GMT
  27. * subjectAltName: host "www.zohoapis.com" matched cert's "*.zohoapis.com"
  28. * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
  29. * SSL certificate verify ok.
  30. > POST /crm/v2/Accounts/upsert HTTP/1.1
  31. > Host: www.zohoapis.com
  32. > User-Agent: curl/7.54.0
  33. > Accept: */*
  34. > Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2
  35. > Content-Length: 388
  36. > Content-Type: application/x-www-form-urlencoded
  37. >
  38. * upload completely sent off: 388 out of 388 bytes
  39. < HTTP/1.1 500 Internal Server Error
  40. < Server: ZGS
  41. < Date: Mon, 18 Jun 2018 17:38:46 GMT
  42. < Content-Type: application/json;charset=utf-8
  43. < Content-Length: 90
  44. < Connection: keep-alive
  45. < Set-Cookie: 6726760df9=92880cd48208c59537587432c6262869; Path=/
  46. < Set-Cookie: crmcsr=1cf4ee36-7482-4c71-bf4e-687ef8f36452; Path=/; Secure
  47. < X-Frame-Options: SAMEORIGIN
  48. < X-Content-Type-Options: nosniff
  49. < X-XSS-Protection: 1
  50. < Pragma: no-cache
  51. < Cache-Control: no-store, no-cache, must-revalidate, private
  52. < Expires: Thu, 01 Jan 1970 00:00:00 GMT
  53. < clientVersion: 1655147
  54. < Set-Cookie: JSESSIONID=FCD34199FAF602BF5913CD2C00744858; Path=/; Secure
  55. < Content-Disposition: attachment; filename=response.json
  56. < X-Download-Options: noopen
  57. < X-ACCESSTOKEN-RESET: 2018-06-18T11:39:39-07:00
  58. < X-RATELIMIT-RESET: 1529343751192
  59. < X-RATELIMIT-REMAINING: 99
  60. < X-RATELIMIT-LIMIT: 100
  61. <
  62. {"code":"INTERNAL_ERROR","details":{},"message":"Internal Server Error","status":"error"}
  63. * Connection #0 to host www.zohoapis.com left intact

upsert seems to be fine to UPDATE:
  1. curl -v -H 'Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2' https://www.zohoapis.com/crm/v2/Accounts/upsert -d '{"data":[{"id":null,"Owner":{"id":"3297614000000156188"},"Description":null,"Account_Name":"Blergh","Phone":null,"Account_Number":null,"Account_Type":null,"Ownership":null,"Industry":null,"Employees":null,"Annual_Revenue":null,"Created_By":{"id":"3297614000000156188"},"Billing_Street":"123 fake street","Billing_City":"Seattle","Billing_State":"Bengo","Billing_Country":"Angola"}]}'
  2. * Trying 216.52.73.111...
  3. * TCP_NODELAY set
  4. * Connected to www.zohoapis.com (216.52.73.111) port 443 (#0)
  5. * ALPN, offering h2
  6. * ALPN, offering http/1.1
  7. * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  8. * successfully set certificate verify locations:
  9. * CAfile: /etc/ssl/cert.pem
  10. CApath: none
  11. * TLSv1.2 (OUT), TLS handshake, Client hello (1):
  12. * TLSv1.2 (IN), TLS handshake, Server hello (2):
  13. * TLSv1.2 (IN), TLS handshake, Certificate (11):
  14. * TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  15. * TLSv1.2 (IN), TLS handshake, Server finished (14):
  16. * TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  17. * TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  18. * TLSv1.2 (OUT), TLS handshake, Finished (20):
  19. * TLSv1.2 (IN), TLS change cipher, Client hello (1):
  20. * TLSv1.2 (IN), TLS handshake, Finished (20):
  21. * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
  22. * ALPN, server accepted to use http/1.1
  23. * Server certificate:
  24. * subject: OU=Domain Control Validated; OU=Hosted by ZOHO Corporation Private Limited; OU=PositiveSSL Multi-Domain
  25. * start date: Jan 17 00:00:00 2018 GMT
  26. * expire date: Jan 17 23:59:59 2020 GMT
  27. * subjectAltName: host "www.zohoapis.com" matched cert's "*.zohoapis.com"
  28. * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
  29. * SSL certificate verify ok.
  30. > POST /crm/v2/Accounts/upsert HTTP/1.1
  31. > Host: www.zohoapis.com
  32. > User-Agent: curl/7.54.0
  33. > Accept: */*
  34. > Authorization: Zoho-oauthtoken 1000.d4ec21a4b5e683bfeed3f545fc4dfeb8.13b57082a6cc54151b673866430dcfb2
  35. > Content-Length: 382
  36. > Content-Type: application/x-www-form-urlencoded
  37. >
  38. * upload completely sent off: 382 out of 382 bytes
  39. < HTTP/1.1 200 OK
  40. < Server: ZGS
  41. < Date: Mon, 18 Jun 2018 17:52:01 GMT
  42. < Content-Type: application/json;charset=utf-8
  43. < Content-Length: 383
  44. < Connection: keep-alive
  45. < Set-Cookie: 6726760df9=c64fc1c7d9f025d094a50b32fda484b2; Path=/
  46. < Set-Cookie: crmcsr=18bbcaa3-5c60-4e78-afb7-93dca1b9fffb; Path=/; Secure
  47. < X-Frame-Options: SAMEORIGIN
  48. < X-Content-Type-Options: nosniff
  49. < X-XSS-Protection: 1
  50. < Pragma: no-cache
  51. < Cache-Control: no-store, no-cache, must-revalidate, private
  52. < Expires: Thu, 01 Jan 1970 00:00:00 GMT
  53. < clientVersion: 1655147
  54. < Content-Disposition: attachment; filename=response.json
  55. < X-ACCESSTOKEN-RESET: 2018-06-18T11:39:39-07:00
  56. < X-RATELIMIT-RESET: 1529344545379
  57. < X-RATELIMIT-REMAINING: 98
  58. < X-RATELIMIT-LIMIT: 100
  59. < Strict-Transport-Security: max-age=15768000
  60. <
  61. * Connection #0 to host www.zohoapis.com left intact
  62. {"data":[{"code":"SUCCESS","duplicate_field":"Account_Name","action":"update","details":{"Modified_Time":"2018-06-18T10:54:45-07:00","Modified_By":{"name":"Alden Prudent","id":"3297614000000155021"},"Created_Time":"2018-06-18T10:39:54-07:00","id":"3297614000000279002","Created_By":{"name":"Alden Prudent","id":"3297614000000155021"}},"message":"record updated","status":"success"}]}