Anyone have success with startingNumber attribute for POST or PUT autoNumberFormat object requests?

coby
coby ✭✭✭✭
edited 10/03/21 in API & Developers

I am trying to modify an a column to an AUTO_NUMBER systemColumnType. The API does NOT return an error, but rather the 'startingNumber' attribute does not actually have an effect on the sheet. I have tried both via the python sdk and also via CUrl command, I'm stumped. Anyone have any luck with this before?

PYTHON

#Column Update

column_spec =   smart.models.Column({

  'type':'TEXT_NUMBER',

  'systemColumnType': 'AUTO_NUMBER',

  'autoNumberFormat': {'startingNumber':50, 'fill':'000000'}

})

# Update column

response = smart.Sheets.update_column(

{SHEET-ID},       # sheet_id

  {COLUMN-ID},       # column_id

  column_spec)


CURL COMMAND

curl https://api.smartsheet.com/2.0/sheets/{SHEET-ID}/columns/{COLUMN-ID} ^

-H "Authorization: {ACCESS TOKEN}" ^

-H "Content-Type: application/json" ^

-X PUT ^

-d "{\"index\":\"0\",\"title\":\"ROW-ID\",\"type\":\"TEXT_NUMBER\",\"systemColumnType\": \"AUTO_NUMBER\",\"autoNumberFormat\": {\"startingNumber\":\"50\", \"fill\":\"000000\"}}"

Answers

  • Etienne Mermillod
    Etienne Mermillod ✭✭✭✭✭

    Hi,

    I just tested with the c# wrapper and it seems to be working :

                SheetFetchedStore.Client.ssclient.SheetResources.ColumnResources.UpdateColumn(8767142637135748,
                   new Smartsheet.Api.Models.Column
                   {
                       Id = 4810157732456324,
                       Title = "tesjthh",
                       Index = 0,
                       Type = Smartsheet.Api.Models.ColumnType.TEXT_NUMBER,
                       SystemColumnType = Smartsheet.Api.Models.SystemColumnType.AUTO_NUMBER,
                       AutoNumberFormat = new Smartsheet.Api.Models.AutoNumberFormat
                       {
                           Fill = "",
                           Prefix = "pfx",
                           StartingNumber = 200,
                           Suffix = "sfx"
                       }
                   });
    
    
    
    

    Body sent :

    {"fill":"","prefix":"pfx","startingNumber":200,"suffix":"sfx"},"index":0,"title":"tesjthh"}
    

    Maybe try by specifing all properties (fill, prefix, starting and suffix) ?