API - Update Custom Tags

Peter_Lay
Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer

Hello!

I'm trying update my tags in Expensify via an API. I would like to structure it to be a kill/fill type process. Currently I am able to update the Tags but not as multiple levels of tags.

Here's the script that i'm using:

{

"type": "update",

  "credentials": {

   "partnerUserID": "_REMOVED_",

   "partnerUserSecret": "_REMOVED_"

  },

  "inputSettings": { 

 "type":"policy",

 "policyID":"2A29DC86CCE1BACE"},

 "tag": 

{"action":"update",

"source":"file",

"config":{"dependency":true,

"glCodes":true,

"header":true,

"setRequired":true,

"fileType":"csv"}}

}


I've also attached the document. I couldn't find the proper format, so it might be the file format that I'm trying to push through that dictates multi-level.

Any help will be greatly appreciated,

Thanks!

Peter. L.

Answers

  • Matt Cole
    Matt Cole Expensify Customer, Expensify Team Posts: 69 Expensify Team

    Hey Peter,

    It sounds like you may be looking for info on how to properly configure multi level tags for updating. For more info on how you can setup multi level tagging, check out this community post. Let us know if you have other questions!

  • Peter_Lay
    Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer

    Hi @Matt Cole

    Thanks for your response. I'm trying to by-pass the user-interface to update the tags in Expensify. The reason being is that we are looking to implement an ERP system that doesn't have a native connector in Expensify. So I'm putting together a plan to push what eventually will be our ERP into Expensify via an API.

    As such, we have a department code that we need to update Expensify with (amongst other tags) I would like to set up our API so that it's loading in as a multi-tag. Currently the script above, would kill/fill the tags in Expensify but not as a multi-tag.

    Can you help me identify the following:

    a) Is it the underlying csv file that dictates the multi-tag?

    b) Is it the script that tells Expensify to use multi-tag?

    Thanks!

    Peter. L.

  • Michael Haxhiu
    Michael Haxhiu Expensify Customer, Expensify Team Posts: 88 Expensify Team

    Hey Peter, sounds like a fun integration project between your ERP and Expensify! Using the API should definitely allow you to upload/update multi-level tags in the product.

    The easiest is to include the tags themselves as a CSV file. You can follow the example in our docs, which I linked to the specific subsection here.

    You can also pass the tag data directly in the request without storing them in a CSV file. There just needs to be a "file" parameter that contains the tag data.

    You can start off with this data as an example, and see how your policy gets updated:

    //

    Tag file - In this example, we have the following data in a file called tags.csv.

    State,State GL,Region,Region GL,City,City GL

    California,100,North,20,San Francisco,1

    California,100,North,20,Oakland,2

    California,100,South,30,Los Angeles,3

    California,100,South,30,San Diego,4

    Texas,200,East,40,Dallas,5

    Texas,200,East,40,Houston,6

    Texas,200,South,50,San Antonio,7

    //

  • Peter_Lay
    Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer

    Hi @Michael Haxhiu

    I've tried using the exact coding and file in the example. When I execute it in postman, it returns with a success message 200. However, when I review Expensify, the settings I had previously have been removed and all the tags are gone.

    Can you please advise?

    Thank you,

    Peter. L.

  • Jason Li
    Jason Li Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 229 Expensify Team

    Hi @Peter_Lay - just to clarify: have you successfully connected Expensify's API to your ERP, or are you manually uploading a set of CSV Tags to Expensify?

  • Peter_Lay
    Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer
    edited July 2020

    @Jason Li

    I have not successfully connected Expensify's API to our ERP. What I'm currently doing is building out the scripts inside Postman so that I can pass it over to our middleware. Our dataflow will be from ERP --> Middleware --> Expensify

    I am not manually uploading a set of CSV Tags to Expensify

    I am trying to push a CSV file content into Expensify via the API

    Currently, the script I've posted yields a Success Message. But when I check expensify, it looks as though it has cleared my entire tags listing.

    See below for script:

    {
    		"type": "update",
    		"credentials": {
    		"partnerUserID": "...",
    		"partnerUserSecret": "..."
      },
      "inputSettings": { 
    		"type":"policy",
    		"policyID":"2A29DC86CCE1BACE"
    	 },
    		"tag": {
    			"action":"replace",
    			"source":"file",
    			"config":{
    				"dependency":true,
    				"glCodes":true,
    				"header":true,
    				"setRequired":true,
    				"fileType":"csv"
    			}
    		}
    }		
    
  • Ted Harris
    Ted Harris Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 359 Expensify Team

    HI @Peter_Lay - that script looks fine. It should be importing tags to "policyID":"2A29DC86CCE1BACE" and then updating the tag list in its entirety to match the CSV.

    Are you saying that rather than doing so, it's simply clearing any tags you have there completely?

  • Peter_Lay
    Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer

    Hi @Ted Harris

    Yeah. I am trying to update that policy with Department Tags, specifically Multiple levels of tags.

    When I execute the script, it clears out all tags. What I've done as a test was manually create 2 tags before executing the script. Once I've executed, refresh the page, the 2 tags that I've created have been removed.

    Thanks for your help!

    Peter. L.

  • Cortney Ofstad
    Cortney Ofstad Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 173 Expensify Team

    Hi @Peter_Lay! That is definitely odd! If possible, can you send a recording showing this to concierge@expensify.com? This will allow our team the ability to see how the system is reacting in realtime, so we can get that corrected!

    Sorry for any hassle that this has caused!

  • Peter_Lay
    Peter_Lay Expensify Customer Posts: 38 Expensify Newcomer

    @Cortney Ofstad

    I'd be more than happy to hop on a call with Concierge if that will resolve this quicker.