Forum Discussion

GeoffBarrenger's avatar
GeoffBarrenger
Qrew Trainee
4 years ago

API API_AddRecord - with Update

Hello, 

Is it possible to use the API_AddRecord with updates? Occasionally there are already historical records with the key field (unique) field, and those commands fail.  The other option it seems is to use API_ImportFromCSV but that will require a fairly large rewrite.  If the API_AddRecord command has a "merge with" or "update" modifier that would be fantastic.  Any ideas?

------------------------------
Geoff Barrenger
------------------------------

10 Replies

  • I'm pretty sure that's not possible with the API_AddRecord call. I've always had to use API_ImportFromCSV or otherwise separate my calls into API_AddRecord and API_EditRecord to perform a mix of adds and updates.  The new RESTful API has an upsert that will do exactly what you need but if converting to API_ImportFromCSV is too big of a lift, switching to the the new API may also be undesirable.  That all depends on your use case so it's probably worth a look: https://developer.quickbase.com/operation/upsert.

    ------------------------------
    Nathan Hawe
    ------------------------------
    • GeoffBarrenger's avatar
      GeoffBarrenger
      Qrew Trainee
      "Upsert" might be good!   I hadn't seen this yet... will have a read through and see if I can format what I need in this way.  The API_ImportFromCSV has some benefits - it's one call for more data instead of doing little calls - but individual calls will be more of a "real time update" which is what we're trying to accomplish.  If anyone else has any other suggestions please send, otherwise thank you Nathan and Mark

      ------------------------------
      Geoff Barrenger
      ------------------------------
  • Are you launching this API off a child record?  Or can this record be a child so it can know if the Parent exists?  If so, your URL formula can have an IF statement to switch to API_EditRecord if the Parent Record Exists.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • GeoffBarrenger's avatar
      GeoffBarrenger
      Qrew Trainee
      Hi, Thanks for the quick reply.  No, it is launching from an Applescript doing an audit on a list of files in specific folders and creating records of the files and metadata in the files.  Occasionally though, there will have been a previous file with the same name (unavoidable), and in this case - the key field value would stay the same, but the other fields will be updated with the new metadata.  There is no way to know (unless DoQuery first? ) if there had been a file before with the same name.  Is the only solution to query first, and if no response AddRecord, but if there is then EditRecord?  Seems cumbersome...

      ------------------------------
      Geoff Barrenger
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion
        In Pipelines hey have an "Upsert".  (ie update or add like a saved table to table import can do)     I don't knbow much about the New Restful APIs, if hey have any new Upsert type API.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------
  • Hi

    Glad to hear you've got a solution that works now.

    An alternative approach you could use is the upsert functionality in the newerJSON API

    https://developer.quickbase.com/operation/upsert

    What's really useful is the fact that this can be called from a quickbase webhook (example screenshot below).

    For bulk record upserts outside of Quickbase, in the past I've used the excellent Qunect ODBC Connector which has upsert capability.

    https://www.qunect.com/

    Cheers

    David



    ------------------------------
    dmlaycock2000 dmlaycock2000
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Qrew Champion
      David, thank you posting that the Restful API's can be initiated with a webhook.  Do you also have the syntax and setup to initiate them from a Pipeline?

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      mark.shnier@gmail.com
      ------------------------------
      • SystemAdmin4's avatar
        SystemAdmin4
        Qrew Member
        Hi Mark,

        Whilst I've played with pipelines, so far we've not become good friends.

        )-:

        The sort of stuff which pipelines ought to excel in, I tend to use Zapier for - primarily because of the maturity of it's UX / error handling (and I have the Zapier account anyway for other things and know the interface inside out).

        D

        ------------------------------
        dmlaycock2000 dmlaycock2000
        ------------------------------