Chilkat Online Tools

Swift / Zoho CRM REST APIs / Update User

Back to Collection Items

func chilkatTest() {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    let http = CkoHttp()
    var success: Bool

    // Use this online tool to generate code from sample JSON: Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "users": [
    //     {
    //       "country": "US",
    //       "city": "Austin",
    //       "street": "6800 Burleson Rd, Building 310, Suite 200",
    //       "alias": "Patricia",
    //       "state": "Texas",
    //       "fax": "444-222",
    //       "zip": "78744",
    //       "website": "www.patriciaboyle.com",
    //       "mobile": "9000000000",
    //       "phone": "044-71817070",
    //       "dob": "1996-02-01",
    //       "role": "{{role_id}}",
    //       "first_name": "Patricia",
    //       "email": "Patricia@abcl.com",
    //       "profile": "{{profile_id}}",
    //       "last_name": "Boyle",
    //       "Currency": "AFN",
    //       "date_format": "MM/dd/yyyy",
    //       "time_format": "hh:mm a",
    //       "territories": [
    //         {
    //           "manager": true,
    //           "name": "North Zone",
    //           "id": "{{terriory_id}}"
    //         },
    //         {
    //           "manager": true,
    //           "name": "South Zone",
    //           "id": "{{territroy_id}}"
    //         }
    //       ]
    //     }
    //   ]
    // }

    let json = CkoJsonObject()
    json.UpdateString("users[0].country", value: "US")
    json.UpdateString("users[0].city", value: "Austin")
    json.UpdateString("users[0].street", value: "6800 Burleson Rd, Building 310, Suite 200")
    json.UpdateString("users[0].alias", value: "Patricia")
    json.UpdateString("users[0].state", value: "Texas")
    json.UpdateString("users[0].fax", value: "444-222")
    json.UpdateString("users[0].zip", value: "78744")
    json.UpdateString("users[0].website", value: "www.patriciaboyle.com")
    json.UpdateString("users[0].mobile", value: "9000000000")
    json.UpdateString("users[0].phone", value: "044-71817070")
    json.UpdateString("users[0].dob", value: "1996-02-01")
    json.UpdateString("users[0].role", value: "{{role_id}}")
    json.UpdateString("users[0].first_name", value: "Patricia")
    json.UpdateString("users[0].email", value: "Patricia@abcl.com")
    json.UpdateString("users[0].profile", value: "{{profile_id}}")
    json.UpdateString("users[0].last_name", value: "Boyle")
    json.UpdateString("users[0].Currency", value: "AFN")
    json.UpdateString("users[0].date_format", value: "MM/dd/yyyy")
    json.UpdateString("users[0].time_format", value: "hh:mm a")
    json.UpdateBool("users[0].territories[0].manager", value: true)
    json.UpdateString("users[0].territories[0].name", value: "North Zone")
    json.UpdateString("users[0].territories[0].id", value: "{{terriory_id}}")
    json.UpdateBool("users[0].territories[1].manager", value: true)
    json.UpdateString("users[0].territories[1].name", value: "South Zone")
    json.UpdateString("users[0].territories[1].id", value: "{{territroy_id}}")

    // Adds the "Authorization: Bearer <access_token>" header.
    http.AuthToken = "<access_token>"
    http.SetRequestHeader("Content-Type", value: "application/json")

    let sbRequestBody = CkoStringBuilder()
    json.EmitSb(sbRequestBody)

    var resp: CkoHttpResponse? = http.PTextSb("PUT", url: "https://domain.com/crm/v2/users", textData: sbRequestBody, charset: "utf-8", contentType: "application/json", md5: false, gzip: false)
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    let sbResponseBody = CkoStringBuilder()
    resp!.GetBodySb(sbResponseBody)

    let jResp = CkoJsonObject()
    jResp.LoadSb(sbResponseBody)
    jResp.EmitCompact = false

    print("Response Body:")
    print("\(jResp.Emit())")

    var respStatusCode: Int = resp!.StatusCode.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode >= 400 {
        print("Response Header:")
        print("\(resp!.Header)")
        print("Failed.")
        resp = nil
        return
    }

    resp = nil

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "users": [
    //     {
    //       "code": "SUCCESS",
    //       "details": {
    //         "id": "738964000000291009"
    //       },
    //       "message": "User updated",
    //       "status": "success"
    //     }
    //   ]
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    var code: String?
    var Id: String?
    var message: String?
    var status: String?

    var i: Int = 0
    var count_i: Int = jResp.SizeOfArray("users").intValue
    while i < count_i {
        jResp.I = i
        code = jResp.StringOf("users[i].code")
        Id = jResp.StringOf("users[i].details.id")
        message = jResp.StringOf("users[i].message")
        status = jResp.StringOf("users[i].status")
        i = i + 1
    }


}

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-d '{
    "users": [
        {
            "country": "US",
            "city": "Austin",
            "street": "6800 Burleson Rd, Building 310, Suite 200",
            "alias": "Patricia",
            "state": "Texas",
            "fax": "444-222",
            "zip": "78744",
            "website": "www.patriciaboyle.com",
            "mobile": "9000000000",
            "phone": "044-71817070",
            "dob": "1996-02-01",
            "role": "{{role_id}}",
            "first_name": "Patricia",
            "email": "Patricia@abcl.com",
            "profile": "{{profile_id}}",
            "last_name": "Boyle",
            "Currency": "AFN",
            "date_format": "MM/dd/yyyy",
            "time_format": "hh:mm a",
            "territories": [
                {
                    "manager": true,
                    "name": "North Zone",
                    "id": "{{terriory_id}}"
                },
                {
                    "manager": true,
                    "name": "South Zone",
                    "id": "{{territroy_id}}"
                }
            ]
        }
    ]
}'
https://domain.com/crm/v2/users

Postman Collection Item JSON

{
  "name": "Update User",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "PUT",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "value": "application/json",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"users\": [\n        {\n            \"country\": \"US\",\n            \"city\": \"Austin\",\n            \"street\": \"6800 Burleson Rd, Building 310, Suite 200\",\n            \"alias\": \"Patricia\",\n            \"state\": \"Texas\",\n            \"fax\": \"444-222\",\n            \"zip\": \"78744\",\n            \"website\": \"www.patriciaboyle.com\",\n            \"mobile\": \"9000000000\",\n            \"phone\": \"044-71817070\",\n            \"dob\": \"1996-02-01\",\n            \"role\": \"{{role_id}}\",\n            \"first_name\": \"Patricia\",\n            \"email\": \"Patricia@abcl.com\",\n            \"profile\": \"{{profile_id}}\",\n            \"last_name\": \"Boyle\",\n            \"Currency\": \"AFN\",\n            \"date_format\": \"MM/dd/yyyy\",\n            \"time_format\": \"hh:mm a\",\n            \"territories\": [\n                {\n                    \"manager\": true,\n                    \"name\": \"North Zone\",\n                    \"id\": \"{{terriory_id}}\"\n                },\n                {\n                    \"manager\": true,\n                    \"name\": \"South Zone\",\n                    \"id\": \"{{territroy_id}}\"\n                }\n            ]\n        }\n    ]\n}"
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2/users",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2",
        "users"
      ]
    },
    "description": "To update the details of a user of your organization.\n\n1. The \"Currency\" Key\nThe value for the currency key can be any one of the (multi currencies enabled) organization currencies. Refer to [Enable Multi-currencies API](https://www.zoho.com/crm/developer/docs/api/v2/enable-multi-currency.html) to know more. The possible values for this key are: ALL, DZD, AOA, ARS, AMD, AWG, AUD, AZN, BSD, BHD, BDT, BBD, BYN, BZD, BMD, BTN, BOB, BAM, BWP, BRL, GBP, BND, BGN, BIF, KHR, CAD, CVE, KYD, XOF, XAF, XPF, CLP, CNY, COP, KMF, CDF, CRC, HRK, CUP, CZK, DKK, DJF, DOP, XCD, EGP, ERN, ETB, EUR, FKP, FJD, GMD, GEL, GHS, GIP, GTQ, GNF, GYD, HTG, HNL, HKD, HUF, ISK, IDR, IRR, IQD, ILS, JMD, JOD, KZT, KES, KWD, KGS, LAK, LBP, LSL, LRD, LYD, MOP, MKD, MGA, MYK, MYR, MVR, MRU, MUR, MXN, MDL, MNT, MAD, MZN, MMK, NAD, NPR, ANG, TWD, NZD, NIO, NGN, KPW, NOK, OMR, PKR, PAB, PGK, PYG, PEN, PHP, PLN, QAR, RON, RUB, RWF, SHP, SVC, WST, RSD, SCR, SLL, SGD, SBD, SOS, ZAR, KRW, LKR, SDG, SRD, SZL, SEK, CHF, SYP, TJS, TZS, THP, TOP, TTD, TND, TRY, TMT, UGX, UAH, CLF, AED, UYU, USD, UZS, VUV, YER, ZMW, VES, ZWL, STN, BOV, GGP, JEP, IMP, SSP, XZR, TVD, COU, UYI, CHE, CHW, SAR, INR, and JPY. Each of these ISO codes represent a unique currency."
  },
  "response": [
    {
      "name": "SUCCESS RESPONSE",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000000291009\",\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:02:23 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "112"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"SUCCESS\",\n            \"details\": {\n                \"id\": \"738964000000291009\"\n            },\n            \"message\": \"User updated\",\n            \"status\": \"success\"\n        }\n    ]\n}"
    },
    {
      "name": "CANNOT_UPDATE_DELETED_USER",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000002112147\",\n            \"phone\": \"123456789\",\n            \"email\": \"newtocrm@zoho.com\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:01:08 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "122"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"CANNOT_UPDATE_DELETED_USER\",\n            \"details\": {},\n            \"message\": \"Deleted user cannot be updated\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "EMAIL_UPDATE_NOT_ALLOWED",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000000291009\",\n            \"phone\": \"123456789\",\n            \"email\": \"newtocrm@zoho.com\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:01:36 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "150"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"EMAIL_UPDATE_NOT_ALOWED\",\n            \"details\": {\n                \"api_name\": \"email\"\n            },\n            \"message\": \"Cannot update email of a confirmed CRM User\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "INVALID_DATA",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": 123,\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:03:40 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "110"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"INVALID_DATA\",\n            \"details\": {},\n            \"message\": \"the id given seems to be invalid\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "AUTHENTICATION_FAILURE",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000000291009\",\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:03:57 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "98"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"code\": \"AUTHENTICATION_FAILURE\",\n    \"details\": {},\n    \"message\": \"Authentication failed\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "INVALID_REQUEST_METHOD",
      "originalRequest": {
        "method": "COPY",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000000291009\",\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:04:19 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "124"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "X-Frame-Options",
          "value": "deny"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"code\": \"INVALID_REQUEST_METHOD\",\n    \"details\": {},\n    \"message\": \"The http request method type is not a valid one\",\n    \"status\": \"error\"\n}"
    },
    {
      "name": "ID_ALREADY_ACTIVE",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000000291009\",\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\",\n            \"status\": \"active\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:06:43 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "105"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"ID_ALREADY_ACTIVE\",\n            \"details\": {},\n            \"message\": \"User is already active\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "ID_ALREADY_DEACTIVATED",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"id\": \"738964000002058003\",\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\",\n            \"status\": \"inactive\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:07:33 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "115"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"ID_ALREADY_DEACTIVATED\",\n            \"details\": {},\n            \"message\": \"User is already deactivated\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "MANDATORY_NOT_FOUND",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\",\n            \"status\": \"inactive\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:08:12 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "124"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"MANDATORY_NOT_FOUND\",\n            \"details\": {\n                \"api_name\": \"id\"\n            },\n            \"message\": \"required field not found\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "DUPLICATE_DATA",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"phone\": \"123456789\",\n            \"dob\": \"1990-12-31\",\n            \"id\": \"738964000002112003\",\n            \"email\": \"patricia.b@zohocorp.com\"\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Tue, 11 May 2021 12:10:21 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "144"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-store, no-cache, must-revalidate, private"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-ACCESSTOKEN-RESET",
          "value": "2021-05-11T12:57:36+00:00"
        },
        {
          "key": "clientVersion",
          "value": "4023320"
        },
        {
          "key": "clientsubVersion",
          "value": "4d8b6ee4f7d1d284c930a4e807480c5c"
        },
        {
          "key": "Content-Disposition",
          "value": "attachment; filename=response.json"
        },
        {
          "key": "Content-Language",
          "value": "en-US"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15768000"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"users\": [\n        {\n            \"code\": \"DUPLICATE_DATA\",\n            \"details\": {\n                \"api_name\": \"email\",\n                \"id\": \"738964000002058003\"\n            },\n            \"message\": \"Email already exists\",\n            \"status\": \"error\"\n        }\n    ]\n}"
    },
    {
      "name": "OAUTH_SCOPE_MISMATCH",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"users\": [\n        {\n            \"country\": \"US\",\n            \"city\": \"Austin\",\n            \"street\": \"6800 Burleson Rd, Building 310, Suite 200\",\n            \"alias\": \"Patricia\",\n            \"state\": \"Texas\",\n            \"fax\": \"444-222\",\n            \"zip\": \"78744\",\n            \"website\": \"www.patriciaboyle.com\",\n            \"mobile\": \"9000000000\",\n            \"phone\": \"044-71817070\",\n            \"dob\": \"1996-02-01\",\n            \"role\": \"{{role_id}}\",\n            \"first_name\": \"Patricia\",\n            \"email\": \"Patricia@abcl.com\",\n            \"profile\": \"{{profile_id}}\",\n            \"last_name\": \"Boyle\",\n            \"Currency\": \"AFN\",\n            \"date_format\": \"MM/dd/yyyy\",\n            \"time_format\": \"hh:mm a\",\n            \"territories\": [\n                {\n                    \"manager\": true,\n                    \"name\": \"North Zone\",\n                    \"id\": \"{{terriory_id}}\"\n                },\n                {\n                    \"manager\": true,\n                    \"name\": \"South Zone\",\n                    \"id\": \"{{territroy_id}}\"\n                }\n            ]\n        }\n    ]\n}"
        },
        "url": {
          "raw": "{{api-domain}}/crm/v2/users",
          "host": [
            "{{api-domain}}"
          ],
          "path": [
            "crm",
            "v2",
            "users"
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "ZGS"
        },
        {
          "key": "Date",
          "value": "Thu, 13 May 2021 06:32:51 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=utf-8"
        },
        {
          "key": "Content-Length",
          "value": "113"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Referrer-Policy",
          "value": "strict-origin"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "Pragma",
          "value": "no-cache"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache"
        },
        {
          "key": "Expires",
          "value": "Thu, 01 Jan 1970 00:00:00 GMT"
        },
        {
          "key": "X-Frame-Options",
          "value": "SAMEORIGIN"
        },
        {
          "key": "X-Download-Options",
          "value": "noopen"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"code\": \"OAUTH_SCOPE_MISMATCH\",\n    \"details\": {},\n    \"message\": \"invalid oauth scope to access this URL\",\n    \"status\": \"error\"\n}"
    }
  ]
}