Jump to content
  • 0

Not able to insert record into Table


pjain

Question

I am trying to insert a record in one of the tables using Caspio API endpoint rest/v2/tables/{Table}/records

I am getting below error while inserting record -

 

{
    "Code""AlterReadOnlyData",
    "Message""Cannot perform operation because one or more fields are read-only.",
    "Resource""https://XXXXX.caspio.com/rest/v2/tables/XXXXXXXXX/records",
    "RequestId""C6EBCC49-4218-4028-B83E-7A0031E3042F"
}
 
I am suspecting this is coming due to our unique identifier which is auto-generated by Caspio. It's definition is -
 
{
      "Format": "1",
      "Prefix": "OBR",
      "Name": "OB_Record_ID",
      "Type": "PREFIXED AUTONUMBER",
      "Unique": true,
      "Description": "Unique identifier for record.",
      "DisplayOrder": 1,
      "Label": "Record ID",
      "UniqueAllowNulls": false,
      "IsFormula": false
    }
 
How do we provide this kind of field in API request. We tried following options but no luck.
 
"OB_Record_ID": "OBR1"
"OB_Record_ID": ""
"OB_Record_ID": "*"
"OB_Record_ID": null
 
 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello @pjain,

Usually this error occurs when the field with the auto-generated data type is used in the request body.

To solve this just skip the OB_Record_ID field and don`t mention it in the request body. It will be populated automatically. 

For example, there is a table with the following fields:

ATMOqvM.png

Request:

brRh3hp.png

 

Result:

V7XxMZ2.png

 

Link to comment
Share on other sites

  • 0

Hello @pjain,

It is strange that images are not visible on your side. 

I mentioned the following Table design in my example:

Field name:                     Data type:
OB_Record_ID             Prefixed Autonumber

Status                               Text(255)

Price                                  Number

 

So, the request body example is:

{
"Status": "In progress",
"Price": 5
}

Could you specify the data types of the fields that you use in your request? 

Do you have Formula, Autonumber, Random ID, GUID? 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...