Table of Contents
- API Usage Guide
- API Command Reference
- add_booking
- add_client
- add_invoice
- add_resource
- approve_request
- authenticate_user
- del_booking
- del_bookings
- del_client
- del_invoice
- del_resource
- email_client
- gen_invoice
- get_activity
- get_availability
- get_booking
- get_booking_type
- get_booking_types
- get_bookings
- get_client
- get_consumable_levels
- get_invoice
- get_invoices
- get_messages
- get_reminders
- get_resource
- get_resource_availability
- get_setting
- get_template
- get_user
- get_users_logged_in
- get_venue
- get_venue_groups
- get_venues
- get_venues_in_group
- get_venues_in_use
- get_watches
- mod_booking
- mod_client
- mod_invoice
- mod_resource
- mod_venue
- notify_user
- reject_request
- restore_booking
- set_setting
- set_template
- util_api_usage
- util_from_epoch
- util_to_epoch
- Appendix A - Activity Codes
- Appendix B - Setting Names
- Appendix C - Error Handling
- Code Samples
- Troubleshooting
- Release Notes
← Hide Table of Contents
MIDAS API: Troubleshooting
If you run into difficulties making API calls, the following solutions may be of use...
When making API calls with a valid key, the only response returned is 401 Unauthorized status with an "invalid api key" message | |
Applies To: | Making API calls via POST if your MIDAS system was purchased before 2016 and is cloud-hosted by us |
Cause: | POST parameters are removed during HTTP 302 server redirects |
Solution 1: | If you're making API calls to the domain "midas.hosting/your_midas_url/api.pl", update your code to make calls to "your_midas_url.mid.as/api.pl" instead, and ensure you're making calls via https instead of http |
Solution 2: | Make API calls via GET instead |
When making a valid API calls, a 404 Not Found HTTP status is returned | |
Applies To: | API calls made in API v2.45 (or later) |
Cause: | Successful API calls should return either a 200 (OK) or 201 (Created) http status code. Unsuccessful API calls may return 4xx/5xx http status codes. An API call can be both valid and unsuccessful at the same time. For example, if you attempt to delete a non-existent booking, a 404 (Not Found) status may be returned, indicating that the booking you were attempting to delete via the API was not found. A complete list of possible HTTP status codes returned by the API is outlined in the Error Response table |
Solution: | Configure your API to return http status code 200 (OK) for every request by enabling the "Force HTTP Status 200 for all responses?" API setting |
When making API calls, the only response returned is "NULL" | |
Applies To: | Using cURL in PHP to make API calls via HTTPS |
Cause: | Receiving a "NULL" response when making API calls in this way will likely be due to the problem that cURL on the server where your PHP script is running has not been configured to trust the HTTPS Certificate Authority (CA) of the server where your MIDAS system resides. There are two solutions to this problem |
Solution 1: | Add the following line to your PHP code (before you call curl_exec):
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); ...this simply configures cURL to accept any server(peer) certificate. Whilst this is a quick solution, it isn't as secure as Solution 2: |
Solution 2: | The more secure option is to use the "CURLOPT_CAINFO" parameter. This is used to point towards a CA certificate that cURL should trust (and therefore any server/peer certificates issued by that CA will also be trusted). In order to do this, you'll need the CA certificate for the server where your MIDAS resides (if your MIDAS is cloud-hosted by us, you can obtain this certificate in a zip file by clicking here). Upload the CA certificate to the server where your PHP script is running from, and then add the following lines to your PHP code: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/midas.hosting.crt"); (This third line assumes the .crt certification can be found in the same directory as your PHP script, otherwise you'll need to adjust the above path according) |
Blank responses are received when making API calls | |
Applies To: | Making API calls if your MIDAS system is cloud-hosted by us |
Cause: | Your IP address has been automatically blocked by our systems due to an excessive API call rate (i.e. flooding our servers with a high number of API calls in a short period of time) |
Solution: | Check the frequency with which calls are being made to the MIDAS API from your code, and if necessary reduce the rate at which these calls are made (to no more than 60 over a 30 second period). Once you've identified the cause of the excessive API calls in your code, and rectified, please contact us to have your IP address unblocked so that you can resume making API calls |
Unable to connect to the API since 1st July 2017 | |
Applies To: | Making API calls if your MIDAS system is cloud-hosted by us |
Cause: | As of 1st July 2017 we no longer accept legacy TLS 1.0 connections across our network [Read More] |
Solution: | Please ensure that your applications and the underlying programming language you develop in can support (and are correctly configured for) TLS 1.2/1.3 connections. For instance Java 6 (1.6) (and lower) and .NET 3.5 (and lower) languages don't support TLS 1.2 |
Unable to connect to the API since 4th July 2020 | |
Applies To: | Making API calls if your MIDAS system is cloud-hosted by us |
Cause: | As of 4th July 2020 we no longer accept legacy TLS 1.1 connections across our network [Read More] |
Solution: | Please ensure that your applications and the underlying programming language you develop in can support (and are correctly configured for) TLS 1.2/1.3 connections. For instance Java 6 (1.6) (and lower) and .NET 3.5 (and lower) languages don't support TLS 1.2 |