Create Api Requests
Less than to read
At the time of writing (October 2024) this action is still in beta with Zapier.
Create your own Zapier Actions and Events with the Zapier API Request action.
Zapier have provided an action that allows an existing Sage Business Cloud Accounting authorisation token to be used in the construction of an API request to any of the public API’s.
Zapier integration scope is now limited to that of the available public API’s.
Example use case
A business owner has an e-commerce store where orders are taken and paid for by a third party payment processor.
To account for the transaction, the order needs to be shown in their backend accounting system as income received. To automate this further the transaction needs to be shown as paid with the payout from the payment provider appearing in the correct bank account.
- Recording the order from the e-commerce store in Sage Business Cloud Accounting can be achieved with the Create Sales Invoice
- Recording the customer payment and allocating it to the newly created sales invoice can be achieved with the Create Contact Payment
- Recording the payout from the payment provider is where the provided actions and events available in the Zapier app run out of scope and the API Request is required.
To record the payment of an invoice from a 3rd party payment provider it’s recommended to create a holding bank account with the name of the payment provider. This account is then used as the recipient for the payment of the sales invoice. When the funds are paid out from the payment provider they are paid into an account nominated by the business. To account for this, a bank_transfer needs to be made to move the paid out funds from the holding account in Sage Business Cloud Accounting to the nominated account.
Creating a Bank Transfer through an API request
There’s a high probability that the bank_account Id’s will be unknown when attempting to create the bank_transfer API request. To obtain a list of bank accounts an API Request can be made to obtain (GET) the bank_accounts data allowing the id’s to be mapped to the relevant fields when the bank_transfer is created (POST).
The GET Request
The GET request is constructed by adding the following values:
- HTTP Method - Select the GET option to return the required bank accounts data
- URL - Add the path to the bank_accounts API. This is obtained from the API Reference Documentation
- Header Parameters need to be added for accept - application/json and content_type - application
- There are no body parameters required when constructing a GET request to any API
ban
The POST request to create the Bank Transfer
The Post request is constructed by adding the following values:
- HTTP Method - Select the POST option to create a new Bank Transfer
- URL - Add the path to the bank_transfers API. This is obtained from the API Reference Documentation
- Header Parameters need to be added for accept - application/json and content_type - application
- The body parameters need to be added in a valid Java Script Object Notation(JSON) format
ban
How do I know the request posted successfully?
The Http response status code returned to Zapier from the Sage Business Cloud Accounting API will return a 200 success for GET requests and a 201 success for POST and PUT requests. Failed requests are denoted by a status code beginning with 4. 401 and 422 are the errors most often seen.
If you see a success response for the POST request the data will now be visible in the Sage Business Cloud Accounting web UI for you to inspect.
Referenced Documentation