In consultation with a customer I verified that API connectivity with the accounting system freee could be realized.
I will summarize the method to set up that connection below.
* If you use this method, achieving automated output from an expense settlement approval flow to the input of the accounting system will be possible.
1: The Reason I Want to Link freee and Questetra
Customers who have consulted with me are managing their expenses with Questetra, and for expenses, a credit card is commonly used. A record is created by importing the credit card information into freee. Based on the information entered in Questetra, it was manually entered in the application column of freee’s expense records.
During the consultation, I was asked to automate this process to reduce time and effort, and so I performed a verification check.
2: Settings for Linking freee and Questetra
If you look at the reference for freee Developers (written in Japanese) you can see that there is a REST API and that OAuth2 can be used for authentication.
Please refer to the following articles for details of OAuth2 settings. Here, I will focus on the specific contents regarding the connection with freee.
* Related article: Settings when calling REST API of Another Service from Questetra (Questetra to be OAuth2 client)
2.1: OAuth Settings in freee
You can register a new application in freee according to the “Introduction” section of freee’s reference.
- “Application name”, “Usage purpose”: Enter to identify yourself
- “Callback URI”: Check and enter on the OAuth setting screen in Questetra as described in the reference article
When you save you can get the “App ID” and “Secret”, so make a note of them.
2.2: OAuth Setting in Questetra
You can receive a token based on the information described in the “Specifications” section of freee’s reference.
- “Authorization endpoint URL” : https://secure.freee.co.jp/oauth/authorize
- “Token endpoint URL” : https://secure.freee.co.jp/oauth/token
- “Client ID”, “Client Secret”: Enter “App ID” and “Secret” obtained in the settings of freee set up in 2.1 chapter
2.3: Settings to Call freee API from Questetra
The API verified this time is as follows.
- Obtain the GET list of Companies
- Obtain the Deals’s GET list / POST creation / PUT update
It was easy to call with “Throwing Message Intermediate Event (HTTP)”.
* Related manual page: M225: Auto Sending of HTTP Requests with Business Data Inserted
Getting a GET list of Companies is simple because you only need to specify the call URL.
To get the GET list of Deals, you can simply add the required parameter company_id to the call URL. As for company_id, it’s OK to specify the ID acquired in the GET list of Companies.
Regarding the Deals’s POST creation / PUT update, I found there were other necessary items besides the required items on the reference (because it would cause an error if you sent JSON for only the required items). First, you make the transaction data manually on Accounting freee and check what type of JSON data is returned by getting the Deal GET list. I prepared the data based on that and it worked fine. However, you should note that the JSON data obtained from the GET list cannot be used as it is (the required JSON data format is slightly different).
In addition, for POST creation / PUT update, since the attached JSON data must be prepared, a “Update Data” or “Script Task” is required.
* Related manual page: M227: Auto Executing Data Binding, Arithmetic Operations
* Related manual page: M230: Auto Executing Complicated Data Processing (ECMAScript)
Also, as for the target record of Deal, I considered the occurrence date, amount and account as the extraction conditions, but since the amount and account could not be specified in the conditions, I acquired a list based on the occurrence date and needed to find the appropriate one in the list.
Deals have a complicated data structure, so it is necessary to consider how to prepare them. But if it is clear what data you want to process, it is relatively easy to automatically enter/update the accounting system.
If you have any questions, please feel free to contact us via the Inquiry .