CRM V2 API is able to create a record entry even when required fields are left empty.

CRM V2 API is able to create a record entry even when required fields are left empty.

I have created an `Orders` custom module as follows:


As you can see, the `random` field is marked as `required` field.

When I edit an order on the crm, as expected, it does not allow me to save the form when I leave these fields blank (screenshot below).



Now the problem is, when I use the API to upsert (create / update) orders, it allows me to leave these fields blank.

  1.     orders = [
  2.       {
  3.         random: "",
  4.         platform_order_id: "order_id_3",
  5.         customer_details: [{
  6.           email: "abc@abc.com",
  7.           phone_number: "1111111111"
  8.         }],
  9.         Name: "DELEETEME",
  10.         shipping_address: [{
  11.           city: "Metro",
  12.           postal_code: nil
  13.         }]
  14.       },
  15.       {
  16.         random: "123",
  17.         platform_order_id: "order_id_1",
  18.         customer_details: [{
  19.           email: "abc@abc.com",
  20.           phone_number: "1111111111"
  21.         }],
  22.         Name: "01422#AB",
  23.         shipping_address: [{
  24.           city: "Metro",
  25.           postal_code: 011233
  26.         }]
  27.       },
  28.       {
  29.         random: nil,
  30.         platform_order_id: "order_id_2",
  31.         customer_details: [{
  32.           email: "abc@abc.com",
  33.           phone_number: "11111111"
  34.         }],
  35.         Name: "01433#Ac",
  36.         shipping_address: [{
  37.           city: "Metro",
  38.           postal_code: ""
  39.         }]
  40.       }
  41.     ]
  42.     response = HTTParty.post("https://www.zohoapis.in/crm/v2/Orders/upsert", {
  43.       headers: {
  44.         "Content-Type": "application/json",
  45.         Authorization: "Zoho-oauthtoken #{ACCESS_TOKEN}"
  46.       },
  47.       body: {
  48.         data: orders.as_json,
  49.         duplicate_check_fields: ["Name"]
  50.       }.to_json
  51.     })

The above payload successfully creates / updates 3 records. Response JSON is as follows:

  1. {
  2.   "data": [
  3.     {
  4.       "code": "SUCCESS",
  5.       "duplicate_field": null,
  6.       "action": "insert",
  7.       "details": {
  8.         "Modified_Time": "2021-12-22T13:23:06+05:30",
  9.         "Modified_By": {
  10.           "name": "haris ",
  11.           "id": "273355000000207001"
  12.         },
  13.         "Created_Time": "2021-12-22T13:23:06+05:30",
  14.         "id": "273355000000259001",
  15.         "Created_By": {
  16.           "name": "haris ",
  17.           "id": "273355000000207001"
  18.         }
  19.       },
  20.       "message": "record added",
  21.       "status": "success"
  22.     },
  23.     {
  24.       "code": "SUCCESS",
  25.       "duplicate_field": "Name",
  26.       "action": "update",
  27.       "details": {
  28.         "Modified_Time": "2021-12-22T13:23:07+05:30",
  29.         "Modified_By": {
  30.           "name": "haris ",
  31.           "id": "273355000000207001"
  32.         },
  33.         "Created_Time": "2021-12-22T11:37:55+05:30",
  34.         "id": "273355000000254004",
  35.         "Created_By": {
  36.           "name": "haris ",
  37.           "id": "273355000000207001"
  38.         }
  39.       },
  40.       "message": "record updated",
  41.       "status": "success"
  42.     },
  43.     {
  44.       "code": "SUCCESS",
  45.       "duplicate_field": "Name",
  46.       "action": "update",
  47.       "details": {
  48.         "Modified_Time": "2021-12-22T13:23:07+05:30",
  49.         "Modified_By": {
  50.           "name": "haris ",
  51.           "id": "273355000000207001"
  52.         },
  53.         "Created_Time": "2021-12-22T11:37:55+05:30",
  54.         "id": "273355000000254007",
  55.         "Created_By": {
  56.           "name": "haris ",
  57.           "id": "273355000000207001"
  58.         }
  59.       },
  60.       "message": "record updated",
  61.       "status": "success"
  62.     }
  63.   ]
  64. }

Is this the expected behaviour via the API? Does this mean that marking fields as "required" is not respected while creating / updating records via the API?