requestJobDescription 'Type' - need to replace existing tags with new ones

Options
ComportTom
ComportTom Expensify Customer Posts: 21 Expensify Newcomer

I am working on a script to update my dependent tags. Each update will potentially add and delete some existing tags.

In the examples I am learning from, the 'type' value is set to "update". I am trying to understand what the "update" behavior is. I know it will ADD records that do not exist, but will it DELETE existing records that are not part of the update file?

I am looking for the exact behavior I get when I upload tags manually. Basically I need to replace the entire existing list with the new one.

Can someone tell me the correct value to use for the 'type' variable?

Answers

  • Francois Laithier
    Francois Laithier Expensify Team Posts: 33 Expensify Team
    Options

    Hi @ComportTom,

    With dependent tags, we only support replacing the existing tags, so yes, the API will delete the existing records that are not part of your update file.

    For a request example, I'd recommend looking at the official docs, the code sample called "Dependent multi-level tags, with GL Codes and tag level names. These must be passed via CSV."

    The tags object would be formatted like so:

            "tags": {
                "action": "replace",
                "source":"file",
                "config": {
                        "dependency":true,
                        "glCodes":true,
                        "header":true,
                        "setRequired":true,
                        "fileType":"csv"
                }
            }