Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

POST request to fill a column with type PICKLIST

Options

I'm using php-curl to add rows to a sheet throught POST requests and it works good to fill all the text fields. 
But when I try to add data for a column that has PICKLIST as type it won't work.

 

So this is how the column is structured.

 

{

         "locked" : true,

         "type" : "PICKLIST",

         "index" : 5,

         "title" : "Severity",

         "lockedForUser" : true,

         "width" : 134,

         "options" : [

            "Critical (Systems are down and no workaround is available)",

            "Major (Functionality is severely impaired)",

            "Medium (Partial/non-critical loss of functionality)",

            "Low (General usage questions. Productivity not impacted)"

         ],

         "id" : 5506789081933700

}

 

This is how I try to add data to for that column

 

"{"columnId": 3713640235853700, "value": "Critical (Systems are down and no workaround is available)"}"

 

I also tried to use ' "value": 0 ' and ' "value": 1 ' as I thought I maybe need to add the index of the array. But that didnt work either. 

 

This is the error I'm getting.

{

  "errorCode" : 1039,

  "message" : "Cannot edit a locked column 5506789081933700",

  "refId" : "erk4rwsf3uyq",

  "detail" : {

    "index" : 0

  }

 

 

So please, what am I doing wrong ? Thanks

 

Comments

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭
    Options

    Error code 1039 is a locked column.

    You can not edit a locked column.

     

    In your results:

     "lockedForUser" : true

     

    You might be able to unlock it, but the API doc is contradictory.

    The Update Column request body lists "locked" but the doc on the lockedForUser in the Column object has this to say:

     

    Flag indicating whether the column is locked for the requesting user. This attribute may be present in a response, but cannot be specified in a request.

     

    I haven't tried this. Curious if you can unlock it.

     

    Craig

  • Yes it is a locked column. But I'm not trying to edit the column though. I'm trying to add a row with data for that column through the API.

     

    If I use an iframe to add rows it works, for that specific column as well.

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭
    Options

    Kristoffer,

     

    My experience has been that any problem in a column will prevent adding or updating a row.

    It has also been my experience that most of the error codes (1039 in your case) are accurate on what the problem is. There have been cases when they were not, but I am not sure if that was the SDK's problem (I use Python unless I need to use cUrl) or my own inexperience.

     

    I don't know what an iframe is in this context. 

     

    Try unlocking the column manually to see if that resolves the issue.

    You can also contact api@smartsheeet.com for expert help.

     

    Craig

     

  • I tested on a new sheet with a picklist column that was unlocked at it worked. So I guess it was that problem. I use PHP Curl. Wish there were more documentation on PHP. 

  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭
    Options

    I took over for a project that was using PHP (WordPress & Gravity Forms).

    It had a lot of problems. One of those was that checkboxes did not work properly.

    The previous developer did not even try to get them to work.

     

    Craig

This discussion has been closed.