Forum Discussion

JimHarrison's avatar
JimHarrison
Qrew Champion
3 years ago

API_ImportFromCSV: update_id documentation

update_id

Attribute of each rid element that defines the update_id for the record.

Update IDs are used to detect update conflicts in subsequent operations with API_EditRecord.


Researching the Quicbase API documentation and trying to understand Response values for update_id. I am not understanding how this is used. Does this make sense to anyone and can you help explain what am I missing?

------------------------------
Jim Harrison
transparency = knowledge + understanding : The Scrum Dudes
------------------------------

2 Replies

  • AustinK's avatar
    AustinK
    Qrew Commander
    Looking at the documentation for API_EditRecord to me it seems like update_id is used to prevent you from editing a record that has recently been edited. Say your script grabs the record information with API_GetRecordInfo first, that will give you the current update_id. Then have your script run and transform whatever it needs to have and when it comes time to do the actual editing of the record you can again grab the update_id and compare it to the current one. If the id does not match then you know the record was updated at some point during your scripts operation and you should probably abort and grab the record information again?

    Not sure if that is how it is meant to be used or not. It does say it "Specifies the latest record state." so maybe it can be used differently but that is what I can come up with as an idea. I would be interested to know how else it might be used...

    I know you specifically mentioned the csv command but I often find more information about things like update_id by looking all over the documentation. I know it isn't ideal. What I typed above would make sense as I am sure importing a csv calls the edit record function in some way if it needs to be changed. That Quickbase magic that is not shown to us so only a guess on my end there.
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion
      Hi Austin, 

      I saw your response and then time happened. Your response is correct but there's more.

      So here is what I got back from QB Support. I think it fills in the missing information. If you look at the API Reference for API_ImportFromCSV it shows a sample response that is repeated for each rid and I am trying to understand it's purpose. I think @Jennifer Chang explains it well.

      Where does the 1057961999003 come from?

      It's auto generated by QuickBase as part of your API call response.

      Why is it the same for each?
      It's the same ID for all record update since all the records listed are added via the same API_ImportFromCSV call. Think of the update_id as the unique identifier for the API_ImportFromCSV action.

      What is the expected response?
      The ID is part of the response that you will received after the completion of your API_ImportFromCSV call.


      Here is the sample I am referencing:

      Sample XML Response (Add New Records)

      <?xml version="1.0" ?>
      <qdbapi>
       <action>API_ImportFromCSV</action>
       <errcode>0</errcode>
       <errtext>No error</errtext>
       <num_recs_input>8</num_recs_input>
       <num_recs_added>8</num_recs_added>
      <rids>
       <rid update_id="1057961999003">1</rid>
       <rid update_id="1057961999003">2</rid>
       <rid update_id="1057961999003">3</rid>
       <rid update_id="1057961999003">4</rid>
       <rid update_id="1057961999003">5</rid>
       <rid update_id="1057961999003">6</rid>
       <rid update_id="1057961999003">7</rid>
       <rid update_id="1057961999003">8</rid>
      </rids>
      </qdbapi>

      ā€‹

      ------------------------------
      Jim Harrison
      transparency = knowledge + understanding : The Scrum Dudes
      ------------------------------