TIM4biz API support and sample code
The TIM4biz API allows developers to create applications that access your
TIM4biz call accounting account. The TIM4biz API definitions are described on the TIM4biz API homepage at https://tim4biz.com/api/.
Access to the TIM4biz APIs requires a TIM4biz account, product license and an API access enabled username.
API calls require a bearer token. This bearer token can be created below for inclusion in your application
and can be created for testing on the API definition page.
The bearer token created is tied to your TIM4biz username and expires with your password.
Create bearer token
TIM4biz API bearer token
On the API definition page each method allows you to test it with a Try it out button.
Before you can test the APIs you must authorize on that page. The bearer token created is the same one created above and
will be displayed in the generated code.
- Go to https://tim4biz.com/api/
Click the green Authorize button on the right.
The Available authorizations window is displayed.
- Enter your TIM4biz username in client_id
- Enter your TIM4biz password in client_secret
Click the green Authorize button
If authorized a green Logout and a black Close button will appear.
- Click the Close button.
When you have finished testing the methods click the Authorize button and click Logout.
TIM4biz API response codes indicate success or error of the API call.
- 200 - Success.
- 400 - Bad request, invalid parameter supplied, for example datetime range was not supplied or a
GET request was made instead of a POST.
- 401 - Unauthorized, invalid bearer token.
- 403 - Forbidden, not licenced.
- 404 - Not found, supplied value not found.
- 429 - Too Many Requests, your rate limit has been exceeded or you have a rate limit of zero.
Rate limit response headers
The TIM4biz API has a rate limit based on the accumulated number of calls a company can make per 60 minutes.
The default value can be increased if required.
TIM4biz API responses include headers that provide you with your rate limit status.
- TIM4biz-Rate-Limit-Limit: The configured number of API calls per 60 minutes
- TIM4biz-Rate-Limit-Remaining: The number of API calls remaining before hitting the 60 minute rate limit
- TIM4biz-Rate-Limit-Limit-24-Hours: The configured number of API calls per 24 hours
- TIM4biz-Rate-Limit-Remaining-24-Hours: The number of API calls remaining before hitting the 24 hour rate limit
API example calls
The TIM4biz API definitions are described on the TIM4biz API homepage at https://tim4biz.com/api/.
Simple TIM4biz API calls are demonstrated below. Alternatively you can use the Swagger Editor
to create a class library to access TIM4biz API.
Simple .NET C# example - HTTP GET
Simple .NET C# code demonstrating making a call to the ExtensionTotal method. Replace the bearer token YOURBEARERTOKEN with your token.
This example won't succeed without a TIM4biz call accounting license.
Simple .NET C# example - HTTP POST
Simple .NET C# code demonstrating making a call to the SetSMS method. Replace the bearer token YOURBEARERTOKEN with your token.
This example won't succeed without a TIM4biz messaging license.
Swagger generated .NET C# class library example
The Swagger Editor at https://editor.swagger.io/ can be used to generate a class library
to access TIM4biz API.
Under the title on the TIM4biz API page at https://tim4biz.com/api/ is a link to the TIM4biz API
JSON definition. Click on that link to open the TIM4biz API JSON definition.
The TIM4biz API JSON definition is displayed.
- Open the Swagger Editor at https://editor.swagger.io/.
Copy the contents of the TIM4biz API JSON file and paste it into the left pane of the Swagger Editor.
There maybe a popup window ask if you wish to convert JSON to YAML, select OK. The TIM4biz API is loaded into the right pane.
At the top of the window select Generate Client and select your target language.
A download is produced, for example, csharp-client-generated.zip, save it to your computer.
- Add the IO.Swagger generated class library to your project and call the generated APIs.
.NET C# code demonstrating making a call to the ExtensionTotal method via the Swagger generated library. Replace the bearer token YOURBEARERTOKEN with your token.
API page not showing updates
After an update to the main API page sometimes it is necessary to force your browser to
show the latest API version. The usual Ctrl+F5 or Shift+Command+R may not be enough. Follow the following steps
to display the latest API version.
- Go to the main API page at https://tim4biz.com/api/
- Click on the JSON link at the top of the page https://tim4biz.com/api/swagger.json
The swagger.json page is opened
Press Ctrl+F5 (or Shift+Command+R as appropriate)
The swagger.json page is refresed
- Return to the main page at https://tim4biz.com/api/
The API page is (finally) refresed
API GET or POST
APIs are requested as either an HTTP GET or an HTTP POST. Each API heading indicates whether it should
be called via a GET or a POST.
- GET is used for requesting information without changing the information.
- POST is used to insert, update or delete remote data.
- Using the incorrect request type will generate a 400 response code.