laravel logo

Working With Eloquent: API Resources In Laravel

August 27, 2019
my java exceptionutil class

My Java ExceptionUtil Class

September 16, 2019

Getting Your Sage One Company ID For API Integration

September 6, 2019 / Hristo Mitev

Note: Sage One has been renamed to Sage Business Cloud.

If you’re looking to integrate into the Sage One API, you will need to get your company id. There is no clear explanation of where to find it, so I hope this helps you.

We will be using curl in this tutorial to talk to the Sage API. If you are looking for more information about the API you can find it on their API help pages.

  1. https://www.sageone.co.za/developer-zone/
  2. https://accounting.sageone.co.za/api/2.0.0/Help
  3. https://www.sageone.co.za/api-methods/

 

How to get your Company ID:

 

You will obviously first need to have a company loaded on Sage. And secondly, you will need to have an API key. To get an API key, follow the instruction on link 1. above.

Their API uses basic webforms authentication. You will need to add your username and password, separated by a semi-colon and Base64 encoded to your headers. E.g. [email protected]:Password123 becomes ZXhhbXBsZUBjb21wYW55LmNvbTpQYXNzd29yZDEyMw==

Then it’s just a matter of making a single GET request to their get companies endpoint which is currently

curl -g -H 'Authorization: Basic ZXhhbXBsZUBjb21wYW55LmNvbTpQYXNzd29yZDEyMw==' 'https://resellers.accounting.sageone.co.za/api/1.1.3/company/Get?apikey={apiKey}'

The above command is sending a GET request to https://resellers.accounting.sageone.co.za/api/1.1.3/company/Get?apikey={apiKey}. And it’s also setting the headers to Authorization: Basic ZXhhbXBsZUBjb21wYW55LmNvbTpQYXNzd29yZDEyMw=='

This will return a list of all companies on your account. You can get the company id from the body. It’s just titled ID. The results look something like this:

{
    "TotalResults": 1,
    "ReturnedResults": 1,
    "Results": [
        {
            "ID": 123456,
            "Name": "Example Company",
            "CurrencySymbol": "R",
            "CurrencyDecimalDigits": 2,
            ...
         },
         ....
     ]
}
Share

Hristo Mitev

Hristo is a frontend developer with knowledge and experience in Laravel.

Getting Your Sage One Company ID For API Integration
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
Read more