TIM4biz API support, tutorial and sample code
The TIM4biz API allows you to create applications that access your PBX call accounting records, settings and other data.
Tutorial sample code for C# and Python is provided below.
The TIM4biz API definitions are described on the API homepage at https://tim4biz.com/api/.
Authorization
Access to the TIM4biz APIs requires a TIM4biz account, product licence and an API access enabled username.
Response codes
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 too long a period was requested
or a GET request was made instead of a POST.
- 401 - Unauthorized.
- 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
Other response headers
- TIM4biz-API-URL: The APIs are moving from tim4biz.com to api.tim4biz.com
- TIM4biz-Authentication: Recommend changing from BEARER to BASIC authentication
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 C# example - HTTP GET
Simple C# code demonstrating making a call to the ExtensionTotal method.
This example won't succeed without a TIM4biz call accounting licence.
Simple Python example - HTTP GET
Simple Python code demonstrating making a call to the ExtensionTotal method.
This example won't succeed without a TIM4biz call accounting licence.
You may need to install the requests and
sys packages before running the sample, for example:
$ python -m pip install requests
$ python -m pip install sys
Simple C# example - HTTP POST
Simple C# code demonstrating making a call to the SetSMS method.
This example won't succeed without a TIM4biz messaging licence.
Simple Python example - HTTP POST
Simple Python code demonstrating making a call to the SetSMS method. This example won't succeed without a TIM4biz messaging licence.
You may need to install the requests and
sys packages before running the sample, for example:
$ python -m pip install requests
$ python -m pip install sys
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/
-
Press Ctrl+F5
The API page is (finally) refreshed
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.