MIDAS API Documentation v2.00
MIDAS API Documentation v2.00
http://mid.as/api
v2.00
making your facilities work for you!
making your facilities work for you!
API Documentation
Table of Contents
API Usage Guide ........................................................1
Overview ................................................................1
Installing the API .....................................................1
Making API calls ......................................................1
API responses..........................................................1
API Settings.............................................................2
Global Parameters..............................................3
Scope .....................................................................3
API Command Reference ...........................................4
add_booking ...........................................................4
add_client...............................................................6
add_invoice ............................................................7
add_resource ..........................................................8
approve_request .....................................................9
del_booking ............................................................9
del_bookings......................................................... 10
del_client.............................................................. 11
del_invoice ........................................................... 12
del_resource ......................................................... 12
email_client .......................................................... 13
get_activity ........................................................... 14
gen_invoice .......................................................... 15
get_availability ...................................................... 16
get_booking .......................................................... 17
get_bookings ........................................................ 19
get_client.............................................................. 21
get_consumable_levels ......................................... 22
get_invoice ........................................................... 23
get_invoices .......................................................... 24
get_messages ....................................................... 25
get_reminders ...................................................... 26
get_resource_availability ....................................... 26
get_setting............................................................ 27
get_template ........................................................ 28
get_user ............................................................... 29
get_venue............................................................. 32
get_venues_in_group ............................................ 34
get_venues_in_use................................................ 35
get_watches ......................................................... 35
mod_booking ........................................................ 36
mod_client............................................................ 38
mod_invoice ......................................................... 39
mod_resource....................................................... 40
notify_user ........................................................... 41
reject_request....................................................... 42
restore_booking .................................................... 42
set_setting ............................................................ 43
set_template ........................................................ 44
util_from_epoch ................................................... 45
util_to_epoch........................................................ 45
Appendix A Activity Codes ..................................... 46
Appendix B Setting Names..................................... 47
Appendix C Error Handling..................................... 51
Code Samples.......................................................... 53
jQuery .................................................................. 53
Perl....................................................................... 53
PHP ...................................................................... 53
Python .................................................................. 54
C#......................................................................... 54
Release Notes.......................................................... 55
http://mid.as/api
API Documentation
API Usage Guide
Overview
The MIDAS API (Application Programming Interface) allows developers to interface directly with MIDAS from their
own applications.
Installing the API
The MIDAS API is an optional add-on for MIDAS v4.03 (or later), that can be purchased along with MIDAS, or added
at a later stage.
To purchase MIDAS and the API addon, please visit: https://mid.as/purchase
To add the API addon to an existing MIDAS installation, please go to MIDAS Admin Options Manage
Addons Available Addons API Access
Once purchased, the API will become available for one-click installation via MIDAS Admin Options Manage Addons
Addons Ready To Install API Access
Once installed, various API settings are available via MIDAS Admin Options Manage Addons Installed Addons
API Access
Making API calls
To make an API call, your application will need to perform an HTTP POST request (GET requests can also be enabled -
see API Settings below) to http://your_midas_url/api.pl. Each request must include as a minimum your unique API
key, an API command and all associated required parameters for the API command issued. Please refer to the API
Command Reference for details of available API commands and associated parameters.
API responses
The MIDAS API returns JSON (JavaScript Object Notation) formatted data. Example responses are shown throughout
the API Command Reference. Error responses are also returned in JSON format and denoted by the term error.
http://mid.as/api P a g e | 1
API Documentation
API Settings
A number of API settings are available via MIDAS Admin Options Manage Add-ons API Access.
Setting Description
Enable API access? Allows enabling/disabling of API access. If disabled, any API calls will return:
{"error":"not enabled"}
Read Only access? With this setting enabled, the API will operate in "read-only" mode and will be prevented
from making any changes to your MIDAS. If you only intend to read data from MIDAS, and
not write/make changes using the API, you should select this option.
Allow GET (as well as
POST) method?
By default, only http POST requests to the API are allowed, and http GET requests are
rejected. Enabling this setting will allow you to perform either GET and POST http requests
to the API
Enable logging of all
calls?
(Only available to self-hosted editions of MIDAS) When enabled, API calls will be logged to
an api_log.dat file (located in your MIDAS directory). The format of each line of this file is
as follows:
timestamp IP_address api_command
This can be used to log/monitor calls to your API. It should only be enabled for debugging
purposes as it will reduce performance of the API, and may lead to a large api_log.dat file if
left enabled for a long of time.
API actions appear in
Recent Activity log?
By default when a user performs an action in MIDAS (such as adding a booking), the action
is recorded in the Recent Activity log. This setting controls whether actions performed
through the API that result in changes to data within MIDAS should also be included in the
Recent Activity log.
Allowed Referrers Allows calls to your API to be restricted from certain domains/IP addresses. If left blank,
API calls will be allowed from any referrer. For calls from banned referrers, the API will
return:
{"error":"referrer not allowed"}
http://mid.as/api P a g e | 2
API Documentation
Global Parameters
The following parameters are required with each API call
Required Parameters Possible Values Description
key <API key> Your unique API key. For security, the API will only respond to your
unique key. Calls made to the API without a key, or with an invalid key,
will not be processed. You should not make your API key
visible/available to anyone.
action <API command> The action you wish the API to perform. See the API Command
Reference for a full list of supported commands.
The following parameters are optional, but may also be included with any API call
Optional Parameters Possible Values Description
l <language> By default, the API will use the en-US language pack where applicable.
To optionally use a different language pack, its corresponding language
code can be specified.
db <database> MIDAS allows you to optionally run multiple, independent, databases
from the same interface. If multiple databases have been setup in your
MIDAS, API calls will be made to whichever database is currently set as
the "default". To make API calls to one of the other defined databases,
its corresponding database code can be passed in the "db" parameter.
To locate the correct database code to pass with the "db" parameter,
open up your midasglobal.dat settings file in a standard text editor and
locate the <database> section within this file. This section contains
details of all defined databases for your MIDAS. The database "code" to
use is the current value of the "r" parameter for the relevant database.
epoch 1 | 0 For API calls that require start/end times, setting epoch to 1 will
accept start/end values in epoch seconds (instead of the default
YYYYMMDDHHMM format)
For API calls that return a date/time, setting epoch to 1 will return
date/time values in epoch seconds (instead of following the current
MIDAS date/time format settings, for instance, DD/MM/YYYY @
HH:MM
What are epoch seconds?
Epoch seconds are the number of seconds that have elapsed since midnight Coordinated Universal Time (UTC) on 1
January 1970
Scope
Version 1.xx of the API offered a "read-only" interface to the MIDAS system, allowing data to be read, but not be
added, changed, or removed.
Version 2.xx of the API provides a "bi-directional" interface to the MIDAS system, allowing data to be both read and
also to be added, changed, or removed.
http://mid.as/api P a g e | 3
API Documentation
API Command Reference
add_booking
Adds a new booking.
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Start time
end Valid date and time
(Format: YYYYMMDDHHMM)
End time
venue Venue ID | Venue Name The unique numeric ID or the name of the venue the
booking is for
Optional Parameters Possible Values Description
client Client ID The numeric ID of the existing client that the booking to
be added is for
type Booking Type ID | Booking
Type Name
The numeric ID of the Booking Type, or the name of the
Booking Type the booking should be assigned
attendees Number The number of booking attendees
notes String Notes about the booking
resources Quantity & Resource ID
|Resource Name
Resources to be added to the booking. Values should be
passed as "qty|resource (ID or name)".
For example, to add 2 Tables to a booking, pass
"2|Tables".
This parameter can be added multiple times to add
further resources
accept_limited_resources 0 | 1 For bookings with Resources, this parameter determines
whether those bookings should still be added if the
quantity of resources requested isn't available.
For example, if you add 10 Tables to a booking, yet only
5 Tables are available, an error will be returned and the
booking won't be added. However, passing the
accept_limited_resources parameter with a value
of "1" will add the booking, but with reduced resource
quantities (in the previous example, this would mean
that only 5 Tables would be added to the booking,
instead of the desired 10)
no_watches 0 | 1 Setting the "no_watches" parameter to "1" will
suppress generation of Watch notifications for users
who are monitoring new bookings, otherwise omitting
this parameter (or setting it to "0") will allow Watch
notifications to be generated accordingly
status request | confirmed If omitted or set to "confirmed", bookings will be
added.
If set to "request", the booking will be added as a
http://mid.as/api P a g e | 4
API Documentation
provisional booking "request" only
<custom fields> Custom Value If you've defined custom booking fields in your MIDAS,
you can optionally specify values for these fields for the
booking you're adding.
For example, if you have a custom field named "My
Custom Field", you would pass the parameter
"my_custom_field" together with the value you wish
to set
Example Response
{
"booking_added":"123"
}
Variables Returned
(on success)
booking_added A unique booking ID corresponding the newly added booking
Variables Returned
(on error)
error The reason why the booking couldn't be added. Typical examples include:
Unavailable (clashes with an existing booking)
Unavailable - Blocked By Meeting Room 1
45 Attendees will exceed the maximum capacity of Meeting Room 1 (15)
Outside Operating Hours
Venue unavailable from 1/1/2015
Venue unavailable between 1/1/2015-1/2/2015
Venue not available until 1/1/2015
Only x5 Tables Available
http://mid.as/api P a g e | 5
API Documentation
add_client
Adds a new client record.
Required Parameters Possible Values Description
client String Client name
Optional Parameters Possible Values Description
org String The client's Organization name
email Email address The client's Email address
address String The client's postal/mailing address
phone Number The client's telephone number
fax Number The client's fax number
mobile Number The client's mobile/cell number
notes String Notes about the client
tax_exempt 0 | 1 Specifies whether the client is exempt from being charged tax on their
invoices. If this parameter is omitted a default value of "0" will be
assumed (i.e. client' is not exempt from tax)quantities (in the previous
example, this would mean that only 5 Tables would be added to the
booking, instead of the desired 10)
Example Response
{
"client_added":"56"
}
Variables Returned
client_added A unique client ID corresponding the newly added client record
http://mid.as/api P a g e | 6
API Documentation
add_invoice
Creates a new invoice.
Required Parameters Possible Values Description
client Client ID The numeric ID of the existing client that the invoice being added for
item_x String The item to be invoiced. Increment x to each new item to appear on the
invoice. For example, to create an invoice with two items, the first item
to appear on the invoice should be passed as item_1, the second as
item_2, and so forth
qty_x Number The quantity of the corresponding item_x item to be added
rate_x Number The rate (charge) (without currency symbol - i.e. 10.00) of the
corresponding item_x item to be added
Optional Parameters Possible Values Description
notes String Additional notes to appear on the invoice
tax Number The percentage rate of tax to be applied to the invoice. If this parameter
is omitted, the default tax rate will be applied
Example Response
{
"invoice_added":"MIDAS00075"
}
Variables Returned
invoice_added The Invoice number/reference of the newly created invoice
http://mid.as/api P a g e | 7
API Documentation
add_resource
Adds a new resource to the system.
Required Parameters Possible Values Description
resource String The name of the new resource
Optional Parameters Possible Values Description
type equipment |
consumable |
staffing
The type of resource to be added. If this parameter is omitted, the
resource type will default to "equipment"
qty Number The available quantity of the new resource. If this parameter is ommited
an "Unlimited" available quantity will be assumed
charge Decimal The charge (without currency symbol - i.e. 10.00) for the resource. This
will be a per-hour charge where the type parameter is set to
"staffing", otherwise this is a per-booking charge
public 0 | 1 Sets whether the resource is publicly requestable (can appear on the
Public Booking Request screen). If this parameter is omitted, the
resource won't be publicly requestable
venues Venue IDs A comma-separated list of Venue ID's the resource will be available to. If
this parameter is omitted, the resource will be available to all venues
Example Response
{
"resource_added":"67"
}
Variables Returned
resource_added A unique resource ID corresponding the newly added resource
http://mid.as/api P a g e | 8
API Documentation
approve_request
Approves a booking request.
Required Parameters Possible Values Description
id Booking ID The numeric ID of the booking request to be approved
Optional Parameters Possible Values Description
silent 0 | 1 By default when a booking request is approved, the original requestor is
sent an email notification informing them that their request has been
approved. Setting "silent" to "1" will suppress the sending of this
notificaton
Example Response
{
"request_approved":"1"
}
Variables Returned
request_approved Returns "1" after a successful approval
del_booking
Deletes a single booking.
Required Parameters Possible Values Description
id Booking ID The unique numerical reference of the booking to be deleted (which can
be determined from the "get_bookings" call)
Optional Parameters Possible Values Description
force 0 | 1 By default, when a booking is "deleted", it still persists in a "hidden"
state (allowing it to be restored at a later stage). Passing the "force"
parameter with a value of "1" will mean that the booking will be
completely removed from the system
no_watches 0 | 1 Setting the "no_watches" parameter to "1" will supress generation of
Watch notifications for users who are monitoring deleted bookings,
otherwise omitting this parameter (or setting it to "0") will allow Watch
notifications to be generated accordingly
Example Response
{
"bookings_deleted":"1"
}
Variables Returned
bookings_deleted The number of bookings deleted
http://mid.as/api P a g e | 9
API Documentation
del_bookings
Deletes multiple bookings across a date range.
Required Parameters Possible Values Description
start Valid date and time
(Format:
YYYYMMDDHHMM)
Sets the start of the window in which bookings should be deleted
end Valid date and time
(Format:
YYYYMMDDHHMM)
Sets the end of the window in which bookings should be deleted
Optional Parameters Possible Values Description
client Client ID Limits deleting bookings to a specific client
venue <Venue Name> Limits deleting of bookings to a specific venue
type <Booking Type> Limits deleting of bookings to a specific booking type
Any combination of the above optional parameters may be used to limit which bookings are deleted. For example,
specifying both a client and a venue will only delete bookings which match BOTH criteria.
Optional Parameters Possible Values Description
force 0 | 1 By default, when a booking is "deleted", it still persists in a "hidden"
state (allowing it to be restored at a later stage). Passing the "force"
parameter with a value of "1" will mean that the booking will be
completely removed from the system
no_watches 0 | 1 Setting the "no_watches" parameter to "1" will supress generation of
Watch notifications for users who are monitoring deleted bookings,
otherwise omitting this parameter (or setting it to "0") will allow Watch
notifications to be generated accordingly
Example Response
{
"bookings_deleted":"7"
}
Variables Returned
bookings_deleted The number of bookings deleted
http://mid.as/api P a g e | 10
API Documentation
del_client
Deletes existing client records.
Required Parameters
(at least 1 required)
Possible Values Description
id Client ID The unique numerical id of the client (which can be determined from the
"get_client" call)
Passing this parameter will override all other required parameters
client String Client name
org String Organization name
email Email address Email address
address String Postal/mailing address
phone Number Telephone number
fax Number Fax number
mobile Number Mobile/cell number
notes String Notes about the client
Optional Parameters Possible Values Description
retain_bookings 1 | 0 By default, when a client is deleted, all associated bookings for the client
are also deleted. Passing the retain_bookings parameter with a value
of "1" will mean that no bookings will be removed when a client is
deleted
Example Response
{
"clients_deleted":"1",
"bookings_deleted":"24"
}
Variables Returned
clients_deleted The number of clients deleted
bookings_deleted The number of bookings deleted
http://mid.as/api P a g e | 11
API Documentation
del_invoice
Deletes an existing invoice
Required Parameters Possible Values Description
invoice Invoice ID The number/reference of the invoice to delete
Example Response
{
"invoice_deleted":"MIDAS00075"
}
Variables Returned
invoice_deleted The Invoice number/reference of the deleted invoice
del_resource
Deletes an existing resource, and removes it from any existing bookings
Required Parameters Possible Values Description
resource Resource ID The numeric ID of the existing resource to delete
Example Response
{
"resource_deleted":"67",
"bookings_affected":"4,8,15,16,23,42"
}
Variables Returned
resource_deleted The numeric ID of the deleted resource
bookings_affected A comma-separated list of all the booking ID's from which the deleted resource has
been removed
http://mid.as/api P a g e | 12
API Documentation
email_client
Send an email to an existing client.
Required Parameters Possible Values Description
client Client ID The numeric ID of the existing client to email
subject String The subject line of the email
body Text The main body of the email. HTML is allowed
Optional Parameters Possible Values Description
invoice Invoice ID The number/reference of an invoice to include within the email. Note:
Only invoices for the specific client being emailed can be included
Example Response
{
"completed":"1"
}
Variables Returned
completed Returns "1" once the API call has completed
http://mid.as/api P a g e | 13
API Documentation
get_activity
Returns all MIDAS user activity between two times. The optional user parameter can be used to limit the activity
returned to a specific user, and the optional filter parameter can be used to limit the results to a specific activity.
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Start time
end Valid date and time
(Format: YYYYMMDDHHMM)
End time
Optional Parameters Possible Values Description
user <Users Full Name> | SYSTEM Limit the returned activity to a specific user identified by
<Users Full Name> or the keyword SYSTEM. SYSTEM
will return activity not assigned to a specific user (for
example database backups, new booking requests
received, etc). If this parameter is omitted, activity for all
users (including SYSTEM) will be returned
filter <activity code> Limit the returned activity to a specific action. See
Appendix A for a list of activity codes
Example Response
{
{
"time":"5/4/2013 @ 07:53",
"user":"SYSTEM",
"action":"BKUP"
},
{
"time":"5/4/2013 @ 07:26",
"user":"Joe Bloggs",
"action":"ADD",
"data1":"12/5/2013 @ 22:00"
}
}
Variables Returned
time Date/Time activity occurred
user User who generated activity
action Code of action performed. See Appendix A for a list of activity codes
data1 Returns additional data specific to action. See Appendix A for more information
data2 Returns additional data specific to action. See Appendix A for more information
data3 Returns additional data specific to action. See Appendix A for more information
data4 Returns additional data specific to action. See Appendix A for more information
http://mid.as/api P a g e | 14
API Documentation
gen_invoice
Automatically generate invoice(s).
To generate an invoice from an existing booking:
Required Parameters Possible Values Description
booking Booking ID The numeric ID of the existing booking for which to
generate an invoice for
Example Response
{
"invoice_created":"MIDAS00075"
}
Variables Returned
invoice_created The Invoice number/reference of the newly generated invoice
To generate a series of invoices across a date range:
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Sets the start of the window in which bookings should be
included in generated invoices
end Valid date and time
(Format: YYYYMMDDHHMM)
Sets the end of the window in which bookings should be
included in generated invoices
Optional Parameters Possible Values Description
client Client ID The numeric ID of the existing client who's bookings
should be included on the generated invoice
Including the optional "client" parameter will limit invoice generation to a single invoice containing all bookings
for the specified client which take place between the specified start/end values.
Omitting the optional "client" parameter will generate separate invoices for each client with bookings taking place
between the specified start/end values.
Example Response
{
"invoices_created":"MIDAS00076,MIDAS00077,MIDAS00078,MIDAS00079"
}
Variables Returned
invoices_created A comma-separated list of all newly generated invoices
http://mid.as/api P a g e | 15
API Documentation
get_availability
Checks whether a venue is available (free) for booking between two times
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Start time
end Valid date and time
(Format: YYYYMMDDHHMM)
End time
venue <Venue name> Venue
Optional Parameters Possible Values Description
attendees <number> The number of desired attendees. If specified, availability
will also be dependent upon whether the number of
attendees if less than the venues capacity and/or
maximum global occupancy levels.
Example Response
{
"availability":"1"
}
Variables Returned
availability Current Venue Availability
A value of 1 means the venue is available on the dates/times specified
A value of Unavailable means the venue is not available on the dates/times
specified (i.e. clashes with an existing booking)
Any other values also mean Unavailable but will specify the reason for the
unavailability i.e. This will exceed your maximum occupancy level, or Venue
unavailable from 6/5/2103
http://mid.as/api P a g e | 16
API Documentation
get_booking
Returns details of a specific booking.
Required Parameters Possible Values Description
id Booking ID The unique numerical reference of the booking
Example Response
{
"id":"222",
"start":"5/4/2013 @ 13:00",
"end":"5/4/2013 @ 14:00",
"venue":"Room 3",
"client":"Some User (Some Org)",
"type":"Community",
"attendees":"30",
"notes":"",
"resources":[
{
"resource":"Laptop",
"qty":"2"
},
{
"resource":"Projector",
"qty":"1"
}
],
"invoice":"MIDAS00001",
"history":[
{
"action":"Added",
"date":"2/4/2013 @ 08:23",
"user":"Joe Bloggs"
},
{
"action":"Modified",
"date":"2/4/2013 @ 16:52",
"user":"Joe Bloggs"
}
],
"status":"confirmed"
}
}
Variables Returned
id Internal Booking ID
start Start date/time of booking
end End date/time of booking
venue Venue
client Client the booking is for
type Booking Type
attendees Estimated number of people attending booking
notes Booking Notes
resources Resources assigned to booking
http://mid.as/api P a g e | 17
API Documentation
resource The name of the resource
qty The quantity of the resource
invoice Invoice in which the booking appears
history Booking history
action The action performed. This will be one of the following:
Booking Request Received, Added, Modified, Deleted, Restored, or
Invoice Created
date The date/time the action occurred
user The user who performed the action
custom fields Any custom booking fields setup in your MIDAS will also be returned
status Denotes whether the booking is a "request", a "confirmed" booking, or whether it
has been "deleted"
http://mid.as/api P a g e | 18
API Documentation
get_bookings
Returns all bookings between two dates/times
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Sets the start of the window for which bookings should be
returned
end Valid date and time
(Format: YYYYMMDDHHMM)
Sets the end of the window for which bookings should be
returned
Optional Parameters Possible Values Description
venue <Venue name> Limits returned bookings to a specific venue
type <Booking Type> Limits returned bookings to a specific booking type
status all | request | deleted Controls which bookings are returned. request will only
return booking requests. deleted will only return
deleted bookings. all will return all bookings (including
deleted bookings and booking requests). If this parameter
is omitted only confirmed bookings will be returned
Example Response
{
{
"id":"222",
"start":"5/4/2013 @ 13:00",
"end":"5/4/2013 @ 14:00",
"venue":"Room 3",
"client":"Some User (Some Org)",
"type":"Community",
"attendees":"30",
"notes":"",
"resources":[
{
"resource":"Laptop",
"qty":"2"
},
{
"resource":"Projector",
"qty":"1"
}
],
"invoice":"MIDAS00001",
"history":[
{
"action":"Added",
"date":"2/4/2013 @ 08:23",
"user":"Joe Bloggs"
},
{
"action":"Modified",
"date":"2/4/2013 @ 16:52",
"user":"Joe Bloggs"
}
]
},
http://mid.as/api P a g e | 19
API Documentation
{
"id":"223",
"start":"5/4/2013 @ 14:15",
"end":"5/4/2013 @ 16:30",
"venue":"Room 4",
"client":"Some User (Some Org)",
"type":"Community",
"attendees":"40",
"notes":"",
"resources":[],
"invoice":"MIDAS00001",
"history":[
{
"action":"Added",
"date":"2/4/2013 @ 08:25",
"user":"Joe Bloggs"
}
]
}
}
Variables Returned
id Internal Booking ID
start Start date/time of booking
end End date/time of booking
venue Venue
client Client the booking is for
type Booking Type
attendees Estimated number of people attending booking
notes Booking Notes
resources Resources assigned to booking
resource The name of the resource
qty The quantity of the resource
invoice Invoice in which the booking appears
history Booking history
action The action performed. This will be one of the following:
Booking Request Received, Added, Modified, Deleted, Restored, or
Invoice Created
date The date/time the action occurred
user The user who performed the action
custom fields Any custom booking fields setup in your MIDAS will also be returned
http://mid.as/api P a g e | 20
API Documentation
get_client
Returns client records
Required Parameters
(at least 1 required)
Possible Values Description
client <Client name> Client name
org <Organization name> Organization name
email <email address> Email address
Optional Parameters Possible Values Description
match exact | loose Allows specifying the closeness of the match.
If match is set exact and client is set to Joe Bloggs,
only clients with the name Joe Bloggs will be returned.
If match is set to loose and email is set to @mid.as,
any client with an @mid.as email address will be
returned.
If the match parameter is omitted only exact matches are
returned
Example Response
{
{
"name":"Joe Bloggs",
"organization":"MIDAS",
"email":"joe@mid.as",
"address":"PO Box 224,Cheadle,Cheshire.SK8 4AF",
"phone":"01234 567 890",
"fax":"01234 567 891",
"mobile":"07123456789",
"notes":"",
"added":"7/8/2012 @ 16:49"
}
}
Variables Returned
name Clients name
organization Clients organization
email Clients email address
address Clients postal address
phone Clients telephone number
fax Clients fax number
mobile Clients mobile (cell) number
notes Notes about the client
added Date/time when client was added to MIDAS
http://mid.as/api P a g e | 21
API Documentation
get_consumable_levels
Returns the current stock level of all consumable items
Required Parameters
This API command has no additional required parameters
Example Response
{
{
"consumable":"Flipchart Paper",
"qty_remaining":"23",
},
{
"consumable":"Permanent Marker Pens",
"qty_remaining":"156",
}
}
Variables Returned
consumable The name of the consumable
qty_remaining The current stock level. If no stock quantity has been defined, qty_remaining will
return Unlimited
http://mid.as/api P a g e | 22
API Documentation
get_invoice
Retrieves a specific invoice
Required Parameters Possible Values Description
invoice <Invoice Reference> Invoice Reference
Example Response
{
"client":"MIDAS (MIDAS2)",
"date":"5/11/2012 @ 10:00",
"items":[
{
"description":"Room 1 (6/11/2012 @ 19:30 - 21:30)",
"qty":"2.00",
"rate":"23.50"
},
{
"description":"Room 2 (13/11/2012 @ 19:30 - 21:30)",
"qty":"2.00",
"rate":"23.50"
}
],
"total":"94.00",
"tax_rate":"20.00",
"tax_amount":"18.80",
"paid":"0.00",
"history":[
{
"action":"Created",
"date":"5/11/2012 @ 08:45",
"user":"MIDAS Administrator"
},
{
"action":"Modified",
"date":"5/11/2012 @ 09:42",
"user":"MIDAS Administrator"
},
{
"action":"Emailed",
"date":"5/11/2012 @ 10:00",
"user":"MIDAS Administrator"
}
]
}
Variables Returned
client Client
date Invoice Date (or Invoice Not Sent if invoice hasnt been emailed/printed)
items Invoice items
description The items description
qty The items quantity
rate The items rate (charge)
total Invoice total (ex tax)
http://mid.as/api P a g e | 23
API Documentation
tax_rate Tax rate (percentage)
tax_amount Tax amount
paid Amount paid
history Invoice history
action The action performed. This will be one of the following:
Created, Modified, Printed, Emailed, Payment Received, Payment
Overdue, Paid In Full
date The date/time the action occurred
user The user who performed the action
get_invoices
Retrieves a list of invoices for a specific client
Required Parameters
(at least 1 required)
Possible Values Description
client <Client name> Client name
org <Organization name> Organization name
email <email address> Email address
Example Response
{
"client":"Joe Bloggs (Bloggs Inc)",
"email":"joe@bloggsinc.com",
"invoices":"MIDAS0001,MIDAS0003,MIDAS0004"
}
Variables Returned
client Client/Organization
email Clients email address
invoices A comma separated list of all invoices associated with the client
http://mid.as/api P a g e | 24
API Documentation
get_messages
Retrieves all current internal messages for a specific user
Required Parameters
(only 1 required)
Possible Values Description
email <users email> Users email address
user <users name> Users name
Example Response
{
{
"message":"Hello World!",
"author":"Joe Bloggs",
"created","24/4/2013 @ 00:03",
"expires","26/4/2013 @ 00:00"
},
{
"message":"This is a test message",
"author":"Jane Doe",
"created","25/4/2013 @ 03:42",
"expires","29/4/2013 @ 12:30"
}
}
Variables Returned
message Details of the watch
author The user who created the message
created Date/Time the message was created
expires Date/Time at which the message expires
http://mid.as/api P a g e | 25
API Documentation
get_reminders
Retrieves all current reminders for a specific user
Required Parameters
(only 1 required)
Possible Values Description
email <users email> Users email address
user <users name> Users name
Example Response
{
{
"reminder":"Reminder: Room 3: 25/4/2013 @ 13:00 - 15:00 Booking for Joe Bloggs",
"expires":"25/4/2013 @ 15:00"
},
{
"reminder":"Reminder: Room 3: 26/4/2013 @ 14:00 - 16:30 Booking for Jane Doe",
"expires":"26/4/2013 @ 16:30"
}
}
Variables Returned
reminder Details of the reminder
expires Date/Time at which the reminder expires
get_resource_availability
Returns the quantity available of a specified resource between two dates/times
Required Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Start time
end Valid date and time
(Format: YYYYMMDDHHMM)
End time
resource <Resource name> Resource name
qty Number Quantity to check
Example Response
{
"available":"2"
}
Variables Returned
available Quantity of specified resources available during times specified
http://mid.as/api P a g e | 26
API Documentation
get_setting
Returns a current MIDAS setting
Required Parameters Possible Values Description
setting <setting name> Setting name. See Appendix B for available setting names
Example Response
{
"email_sendfrom":"midas@yourorganization.com"
}
Variables Returned
<setting> The current value of the specified <setting>
http://mid.as/api P a g e | 27
API Documentation
get_template
Returns the contents of a template
Required Parameters Possible Values Description
template name <template name> Template name. See below for available template names
Template Name Description Additional
email Email (General)
email_book_confirm Email (Booking Confirmation) Email subject
email_book_remind Email (Booking Reminder) Email subject
email_req_approved Email (Booking Request Approved) Email subject
email_req_approved_m Email (Booking Request Approved with changes) Email subject
email_req_rejected Email (Booking Request Rejected/Declined) Email subject
email_req_submitted Email (Booking Request Submitted) Email subject
email_inv_overdue Email (Invoice Overdue) Email subject
email_inv_remind Email (Invoice Reminder) Email subject
invoice Invoice
payonline Online Payments URL of external .css file
print Print
webrequest Public Booking Requests URL of external .css file
intro Welcome Note (on login screen)
Example Response
{
"email":"<table style=\"width:100%\"><tr>
<td>%LOGO%</td><td><b>%DATABASE%</b></td><td>%MIDASLOGO%</td></tr>
</table>%CONTENT%"
}
Variables Returned
<template> The current contents of the specified <template>
additional For templates which contain an additional value in addition to the main template
content (such as email templates with an additional subject line), this value is
returned in the "additional" parameter
http://mid.as/api P a g e | 28
API Documentation
get_user
Returns user information
Required Parameters
(at least 1 required)
Possible Values Description
user <name> Users full name
email <email address> Users email address
Optional Parameters Possible Values Description
match exact | loose Allows specifying the closeness of the match.
If match is set exact and user is set to Joe Bloggs,
only users with the name Joe Bloggs will be returned.
If match is set to loose and user is set to Joe, any
user named Joe will be returned.
If the match parameter is omitted only exact matches are
returned
Example Response
{
{
"name":"Joe Bloggs",
"email":"joe@bloggs.com",
"added":"25/2/2013 @ 16:49",
"last_login":"23/4/2013 @ 20:51",
"last_password_change":"29/3/2013 @ 18:34",
"last_modified":"25/2/2013 @ 23:42",
"account_locked":"0",
"failed_login_attempts":"0",
"day_starts_at":"00",
"day_runs_for":"24",
"do_not_log_activity":"0"
"email_calendar_events":"1",
"email_messages":"0",
"email_pending_notifications":"1",
"email_watch_notifications":"0",
"force_pw_change_at_login":"0",
"suppress_messages_popup":"0",
"venue_group_access":"Group A,Group B",
"permissions":[
{
"can_add_bookings":"1",
"can_add_clients":"1",
"can_add_day_notes":"1",
"can_add_historical_bookings":"0",
"can_add_out_of_hours_bookings":"0",
"can_change_password":"1",
"can_delete_bookings":"2",
"can_delete_clients":"1",
"can_email_clients":"1",
"can_evac":"1",
"can_invoice":"1",
"can_manage_booking_types":"1",
"can_manage_midas":"1",
http://mid.as/api P a g e | 29
API Documentation
"can_manage_resources":"1",
"can_manage_users":"1",
"can_manage_venues":"1",
"can_modify_bookings":"2",
"can_modify_clients":"",
"can_print":"1",
"can_process_requests":"1",
"can_restore_bookings":"1",
"can_use_mymessages":"1",
"can_view_activity_log":"1",
"can_view_clients":"2",
"can_view_statistics":"1"
}
]
}
}
Variables Returned
name Users name
organization Users email address
added Date/Time user was added to MIDAS
last_login Date/Time user last successfully logged in
last_password_change Date/Time user last changed their password
last_modified Date/Time user information was last modified
account_locked Indicates if the user has been suspended / locked out of MIDAS
failed_login_attempts The number of unsuccessful login attempt on this account since last
successful login
day_starts_at The hour (in 24-hour clock mode) the users booking grid is displayed
from
day_runs_for The number of hours the users booking grid displays
do_not_log_activity If 0 all user activity within MIDAS will be recorded in the Recent
Activity Log
If 1 user activity within MIDAS will appear in the Recent Activity Log,
except for logins/logouts
If 2 no user activity will be recorded in the Recent Activity Log
email_calendar_events Indicates whether reminders should also be sent to users email as
calendar events
email_messages Indicates whether messages are forwarded to users email
email_pending_notifications Indicates whether new booking request notifications are forwarded to
users email
email_watch_notifications Indicates whether watch notifications are forwarded to users email
force_pw_change_at_login Indicates whether user is required to change their password upon next
login
suppress_messages_popup Indicates whether the My Messages pop-up is suppressed (not
shown) after login
venue_group_access Indicates which Venue Groups the user has access to in the Booking
Grid.
A value of * indicates user can view all Venue Groups
permissions The various permissions associated with the user account. Most take a
value of either 1 meaning user has been granted a permission, 0
meaning the user does not have a permission. Permissions with
http://mid.as/api P a g e | 30
API Documentation
additional possible values are indicated.
can_add_bookings User can add bookings.
0 indicates user may not make bookings
1 indicates user may make bookings
2 indicates user may only make booking requests
can_add_clients User can add clients
can_add_day_notes Use can add notes to calendar dates
can_add_historical_bookings User can add bookings for dates occurring in the past
can_add_out_of_hours_bookings User can add bookings outside of a venues operating hours
can_change_password User can change their password
can_delete_bookings User can delete bookings
0 indicates user cannot delete any bookings
1 indicates user may delete only those bookings originally added by
them
2 indicates user may delete any booking
can_delete_clients User can delete clients
can_email_clients User can email clients directly from MIDAS
can_evac User can print Emergency Evacuation data
can_invoice User can use invoicing
can_manage_booking_types User can manage Booking Types
can_manage_midas User can manage MIDAS
can_manage_resources User can manage Resources
can_manage_users User can manage Users & Permissions
can_manage_venues User can manage Venues
can_modify_bookings User can modify bookings
0 indicates user cannot modify any bookings
1 indicates user may modify only those bookings originally added by
them
2 indicates user may modify any booking
can_modify_clients User can modify clients
can_print User can use print functions
can_process_requests User can approve/reject pending booking requests
can_restore_bookings User can restore previously deleted bookings
can_use_mymessages Use can use My Messages (Messages, Reminders, and Watches)
can_view_activity_log Use can access the Recent Activity log
can_view_clients User can view client information
0 indicates user cannot view any client data
1 indicates user can view client and organization names only
2 indicates user can view full client info for any client
3 indicates user can only view full client into for clients theyve added
bookings for
can_view_statistics Use can access Statistics
http://mid.as/api P a g e | 31
API Documentation
get_venue
Returns venue information
Required Parameters Possible Values Description
venue <Venue name> Venue name
Optional Parameters Possible Values Description
match exact | loose Allows specifying the closeness of the match.
If match is set exact and venue is set to Meeting
Room, only the venue with the name Meeting Room
will be returned.
If match is set to loose and venue is set to Meeting
Room, any venue containing the name Meeting Room,
such as Meeting Room A, Meeting Room B, etc will be
returned.
If the match parameter is omitted only exact matches are
returned
Example Response
{
{
"venue":"Room 1",
"capacity":"20",
"description":"A small meeting room",
"requestable":"1",
"rates":[
{
"Mon":[
{
"rate":"100.00",
"rate_length":"1",
"rate_type":"Hourly"
},
{
"rate":"80.00",
"rate_length":"4",
"rate_type":"Hourly"
},
{
"rate":"450.00",
"rate_length":"6",
"rate_type":"Booking"
}
],
"Tue":[
{
"rate":"20.00",
"rate_type":"Hourly"
}
],
"Wed":[
{
"rate":"20.00",
http://mid.as/api P a g e | 32
API Documentation
"rate_type":"Hourly"
}
],
"Thu":[
{
"rate":"20.00",
"rate_type":"Hourly"
}
],
"Fri":[
{
"rate":"20.00",
"rate_type":"Hourly"
}
],
"Sat":[
{
"rate":"20.00",
"rate_type":"Hourly"
}
],
"Sun":[
{
"rate":"20.00",
"rate_type":"Hourly"
}
]
}
],
"operating_hours":[
{
"day":"Mon",
"closed":"0000-0800,2100-2400",
},
{
"day":"Tue",
"closed":"0000-0800,2100-2400",
},
{
"day":"Wed",
"closed":"0000-0800,2100-2400",
},
{
"day":"Thu",
"closed":"0000-0800,2100-2400",
},
{
"day":"Fri",
"closed":"0000-0800,2100-2400",
},
{
"day":"Sat",
"closed":"0000-0930,2000-2400",
},
{
"day":"Sun",
"closed":"0000-1000,1600-2400"
}
],
http://mid.as/api P a g e | 33
API Documentation
"closed_from":"",
"closed_until":"1/4/2013",
"managers":"Jane Doe,Joe Bloggs",
"member_of":"Group A,Group B"
}
}
Variables Returned
venue Venue name
capacity The maximum occupancy of the venue
description The venues description
requestable Whether the venue is available for public requesting
rates The room rate/hire charge for each day of the week
<day> Can be one of the following: "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" to denote
subsequent rate information for each day of the week
rate The room/rate hire charge amount
rate_length The minimum length of the booking the rate applies to (in hours)
rate_type If "Hourly", the rate is per-hour, if "Daily", the rate is per-day, if "Booking", the rate is
per-booking
operating_hours The times between which the venue is closed during each day of the week
day The day of the week
closed A comma separated list of the times (24 hour format) the venue is closed
closed_from The date after which the venue is considered closed
closed_until The date until which the venue is considered closed
managers A comma separated list of user who are Managers of the venue i.e. can approve
Booking Requests for the venue
member_of A comma separated list of Venue Groups to which the venue belongs to
get_venues_in_group
Returns a list of venues in a venue group
Required Parameters Possible Values Description
group <venue group> Name of a venue group
Example Response
{
"Group A":"Room 1,Room 2,Room3"
}
Variables Returned
<group name> Comma separated list of current venues in group
http://mid.as/api P a g e | 34
API Documentation
get_venues_in_use
Returns a list of all venues in use at the point in time when the API call is made. If optional start and end parameters
are supplied, returns a list of all venues in use between start and end parameters.
Optional Parameters Possible Values Description
start Valid date and time
(Format: YYYYMMDDHHMM)
Start time
end Valid date and time
(Format: YYYYMMDDHHMM)
End time
Example Response
{
"venues":"Room 1,Room 2,Room3"
}
Variables Returned
venues Comma separated list of venues in use
get_watches
Retrieves all current watches for a specific user
Required Parameters
(only 1 required)
Possible Values Description
email <users email> Users email address
user <users name> Users name
Example Response
{
{
"watch":"Booking Matching [Venue: Room 1] on 25/4/2013 @ 13:00 - 15:00 For Joe
Bloggs Added",
"expires":"25/4/2013 @ 15:00"
},
{
"watch":"Booking Matching [Venue: Room 4] on 25/4/2013 @ 14:00 - 16:30 For Jane
Doe Deleted",
"expires":"26/4/2013 @ 16:30"
}
}
Variables Returned
watch Details of the watch
expires Date/Time at which the watch expires
http://mid.as/api P a g e | 35
API Documentation
mod_booking
Modifies an existing booking.
Required Parameters Possible Values Description
id Booking ID The unique numeric ID of the booking to be modified
In addition, one or more of the parameters from the following table must also be included with the call. Only values
for the parameters you specify will be changed. For example, to only change a booking type, whilst retaining the
booking's original start, end, and venue details, only pass the "new_type" parameter. To change the venue and the
type and the venue, pass both "new_type" and "new_venue".
Optional Parameters
(at least 1 required)
Possible Values Description
new_start Valid date and time
(Format: YYYYMMDDHHMM)
The new start date/time the booking should be changed
to
new_end Valid date and time
(Format: YYYYMMDDHHMM)
The new end date/time the booking should be changed
to
new_venue Venue ID | Venue Name The numeric ID or name of the venue the booking
should be changed to
new_client Client ID The numeric ID of the client the booking should be
changed to
new_type Booking Type ID | Booking
Type Name
The numeric ID of the Booking Type, or the name of the
Booking Type the booking should be changed to
new_attendees Number The new number of booking attendees
new_notes String New notes about the booking
new_resources Quantity & Resource ID
|Resource Name
New resources to be added to the booking. Values
should be passed as "qty|resource (ID or name)".
For example, to add 2 Tables to a booking, pass
"2|Tables".
This parameter can be added multiple times to add
further resources
Note: Passing the "new_resources" parameter will
remove any previous resources that had been assigned
to the booking
<new custom fields> Custom Value If you've defined custom booking fields in your MIDAS,
you can optionally specify new values for these fields
for the booking you're modifying.
For example, if you have a custom field named
"Insurance", you would pass the parameter
"new_insurance" together with the new value you
wish to set
Optional Parameters Possible Values Description
accept_limited_resources 0 | 1 If you're specifying new resources for a booking, this
parameter determines whether the bookings should
still be modified if the quantity of resources requested
isn't available.
http://mid.as/api P a g e | 36
API Documentation
For example, if you add 10 Tables to a booking, yet only
5 Tables are available, an error will be returned and the
booking won't be modified. However, passing the
"accept_limited_resources" parameter with a
value of "1" will continue the modify booking, but with
reduced resource quantities (in the previous example,
this would mean that only 5 Tables would be added to
the booking, instead of the desired 10)
no_watches 0 | 1 Setting the "no_watches" parameter to "1" will
suppress generation of Watch notifications for users
who are monitoring modified bookings, otherwise
omitting this parameter (or setting it to "0") will allow
Watch notifications to be generated accordingly
Example Response
{
"booking_modified":"1"
}
Variables Returned
(on success)
booking_modified Returns "1" if the booking was successfully modified
Variables Returned
(on error)
error The reason why the booking couldn't be modified. Typical examples include:
Unavailable (clashes with an existing booking)
Unavailable - Blocked By Meeting Room 1
45 Attendees will exceed the maximum capacity of Meeting Room 1 (15)
Outside Operating Hours
Venue unavailable from 1/1/2015
Venue unavailable between 1/1/2015-1/2/2015
Venue not available until 1/1/2015
Only x5 Tables Available
http://mid.as/api P a g e | 37
API Documentation
mod_client
Modifies an existing client record.
Two sets of parameters are required (outlined in the tables below) - the first set controls which client(s) to modify,
the second set specifies which parameters of the selected client(s) to modify.
Controlling which client(s) to modify:
Required Parameters
(at least 1 required)
Possible Values Description
id Client ID The unique numerical id of the client (which can be determined from the
"get_client" call)
Passing this parameter will override all other required parameters in this
table
client String The name of the existing client to be modified
org String Organization name
email Email address Email address
address String Postal/mailing address
phone Number Telephone number
fax Number Fax number
mobile Number Mobile/cell number
notes String Notes about the client
To ensure that only a single client is modified, pass only the "id" parameter, or alternatively as many of the other
above parameters as possible to ensure a specific individual client is modified, rather than a group of clients. For
example, if you only pass the "org" parameter alone ALL clients in the database that match the organization name
you supply will be modified. Whereas passing both the client name and the organization name will ensure that only
client records that match BOTH will be modified. Passing "client_id" alone will ensure that only one client will be
modified.
Setting new values:
Required Parameters
(at least 1 required)
Possible Values Description
new_client String The new Client name
new_org String The new Organization name
new_email Email address The new Email address
new_address String The new postal/mailing address
new_phone Number The new telephone number
new_fax Number The new fax number
new_mobile Number The new mobile/cell number
new_notes String New notes about the client
new_tax_exempt 0 | 1 Specifies whether the client is exempt from being charged tax on their
invoices
Omitting any of the above parameters will leave its current value unchanged. Passing any of the above parameters
with a "blank" value will clear/delete the current value of the corresponding field.
http://mid.as/api P a g e | 38
API Documentation
Example Response
{
"clients_modified":"1"
}
Variables Returned
clients_modifed The number of clients modified
mod_invoice
Modifies/Updates the status of an existing invoice.
Required Parameters Possible Values Description
invoice Invoice ID The number/reference of the invoice to update
Required Parameters
(at least 1 required)
Possible Values Description
client Client ID The numeric ID of the existing client to change the invoice for. Note:
Only unsent invoices can have their client changed
notes String Additional notes to appear on the invoice
paid Decimal The amount (without currency symbol - i.e. 100.00) of the invoice total
already paid
Example Response
{
"invoice_updated":"MIDAS00075"
}
Variables Returned
invoice_updated The Invoice number/reference of the updated invoice
http://mid.as/api P a g e | 39
API Documentation
mod_resource
Modifies an existing resource.
Required Parameters Possible Values Description
resource Resource ID The numerical ID of the existing resource to modify
Optional Parameters
(at least 1 required)
Possible Values Description
new_name String The new name for the existing resource
new_type equipment |
consumable |
staffing
The new type (category) of the resource
new_qty Number The new available quantity of the resource. Passing this parameter with
a blank value will reset the available quantity to "Unlimited"
new_charge Decimal The new charge (without currency symbol - i.e. 10.00) for the resource.
This will be a per-hour charge where the resource is of "staffing"
type/category, otherwise this is a per-booking charge
new_public 0 | 1 Sets whether the resource is publicly requestable (can appear on the
Public Booking Request screen)
new_venues Venue IDs A comma-separated list of Venue ID's the resource is available to.
Passing this parameter with a blank value will reset the resource to be
available to all venues
Omitting any of the above parameters will leave its current value unchanged. Passing any of the above parameters
with a "blank" value will clear/delete the current value of the corresponding field.
Example Response
{
"resource_modified":"67"
}
Variables Returned
resource_modified The unique resource ID corresponding the modified resource
http://mid.as/api P a g e | 40
API Documentation
notify_user
Sends an internal notification to a MIDAS user.
The notification will appear in the user's "My Messages" screen, and may also be forwarded to their email address if
they have configured message forwarding.
Required Parameters Possible Values Description
user User ID | User
email
The numeric ID of the existing user to message, or their email address
(Note: If an email address is supplied which doesn't match an existing
user, the message will fail)
message Text The message to send
expires Valid date and time
(Format:
YYYYMMDDHHMM)
The date/time after which the message should expire and be
automatically removed from the recipient's My Messages screen (The
user may choose to manually remove the message sooner)
Optional Parameters Possible Values Description
type message |
reminder
Sets the type of notification to send. If omitted, the type will be set to
"message"
Example Response
{
"completed":"1"
}
Variables Returned
completed Returns "1" once the API call has completed
http://mid.as/api P a g e | 41
API Documentation
reject_request
Rejects/declines a booking request.
Required Parameters Possible Values Description
id Booking ID The numeric ID of the booking request to be rejected
Optional Parameters Possible Values Description
reason String A reason why the request is being rejected (will be included in the
rejection email notification sent to the original requestor)
silent 0 | 1 By default when a booking request is rejected, the original requestor is
sent an email notification informing them as such. Setting "silent" to
"1" will suppress the sending of this notificaton
Example Response
{
"request_rejected":"1"
}
Variables Returned
request_rejected Returns "1" after a successful rejected
restore_booking
Re-instates a recently deleted booking, or bookings.
Required Parameters Possible Values Description
id Booking ID The unique numerical reference (or comma separated list of references)
of the deleted booking(s) to be re-instated (which can be determined
from the "get_bookings" call)
Example Response
{
"restored":"925",
"not_restored":"927,929,1024",
}
Variables Returned
restored Comma-separated list of all deleted booking references successfully
not_restored Comma-separated list of all booking references that couldn't be restored (i.e. those which
would now clash with other bookings if restored)
http://mid.as/api P a g e | 42
API Documentation
set_setting
Changes the value of a current MIDAS setting
Required Parameters Possible Values Description
setting <setting name> Setting name. See Appendix B for available setting names
value <new value> The new value for the setting
Example Response
{
"response":"ok"
}
Variables Returned
response Returns "ok" after a successful setting change
http://mid.as/api P a g e | 43
API Documentation
set_template
Set/Modify a template
Required Parameters Possible Values Description
template name <template name> Template name. See below for available template names
content Text New HTML template content
Optional Parameters Possible Values Description
additional String For templates where an additional value can be set (such
as email templates where a subject line may be specified),
this new value can be passed via the "additional"
parameter. See below for which templates support this
paramter
Template Name Description Additional
email Email (General)
email_book_confirm Email (Booking Confirmation) Email subject
email_book_remind Email (Booking Reminder) Email subject
email_req_approved Email (Booking Request Approved) Email subject
email_req_approved_m Email (Booking Request Approved with changes) Email subject
email_req_rejected Email (Booking Request Rejected/Declined) Email subject
email_req_submitted Email (Booking Request Submitted) Email subject
email_inv_overdue Email (Invoice Overdue) Email subject
email_inv_remind Email (Invoice Reminder) Email subject
invoice Invoice
payonline Online Payments URL of external .css file
print Print
webrequest Public Booking Requests URL of external .css file
intro Welcome Note (on login screen)
Example Response
{
"response":"ok"
}
Variables Returned
response Returns "ok" after a successful template change
http://mid.as/api P a g e | 44
API Documentation
util_from_epoch
Converts epoch seconds to a standard date/time format
Required Parameters Possible Values Description
data Epoch seconds Epoch seconds to convert
Optional Parameters Possible Values Description
format 1 | 0 If omitted (or 0), the returned date/time string will be in
the format YYYYMMDDHHMM.
If 1, the returned date/time string will reflect the
current time/date format settings in MIDAS, for instance,
DD/MM/YYYY @ HH:MM
Example Response
{
"response":"201305121008"
}
Variables Returned
response The converted epoch time, returned in a date/time format specified by the format
parameter. If no format parameter specified, response is returned as
YYYYMMDDHHMM
util_to_epoch
Converts a date/time to epoch seconds
Required Parameters Possible Values Description
data Valid date and time
(Format: YYYYMMDDHHMM)
Date/Time string to convert to epoch seconds
Example Response
{
"response":" 1357066800"
}
Variables Returned
response The converted date/time, returned as epoch seconds
http://mid.as/api P a g e | 45
API Documentation
Appendix A Activity Codes
The following codes may be used in conjunction with the get_activity call
CODE Description Data1 Data2 Data3 Data4
ADD User added booking Date/Time
ADD2VG User added venue to group Venue Venue Group
ADDBT User added booking type Type Col or
ADDC User added client Cl i ent Organi zation
ADDI User created invoice I nvoi ce
ADDRES User added resource Resource
ADDU User added User Name Emai l
ADDV User added venue Venue
ADDVG User added venue group Venue Group
BKUP MI DAS backup (Automatic)
CANR Booking request cancelled Cl i ent Organi zation
DELB User deleted booking Date/Time
DELBT User deleted booking type Type
DELC User deleted client Cl i ent Organi zation
DELI User deleted invoice I nvoi ce
DELRES User Deleted Resource Resource
DELV User deleted venue Venue
DELVG User deleted venue group Venue Group
EMS User sent email Cl i ent Subject
EMSI User sent email invoice Cl i ent I nvoi ce
EXPB User exported bookings
EXPC User exported clients
EXPIS User exported invoice summaries
EXPR User exported resources
GENI User generated i nvoice I nvoi ce
IN User l ogged in
MBKUP MI DAS backup (Manual)
MOD User modified booking Date/Time
MODBT User modified booking type Previ ous Type Previ ous Color New Type New Col or
MODC User modified client Cl i ent Organi zation
MODI User modified invoice I nvoi ce
MODRES User Modified Resource Resource
MODU User modified User Name Emai l
MODV User modified venue Venue
MREST User Restored a MI DAS backup Date/Time
NEWR Booking request received Cl i ent Organi zation
OUT User l ogged out
PAYIF Payment received in full I nvoi ce Payer name Payer email Transaction I D
PAYIP Parti al payment received I nvoi ce Payer name Payer email Transaction I D
PEED User pri nted Emergency Evacuation Data
PENA User approved booking Date/Time Cl i ent
PENR User rejected booking Date/Time Cl i ent Reason
PRNT User pri nted bookings Pri nt Ti tl e
PRNTI User pri nted i nvoice Cl i ent I nvoi ce
PWC User changed password
REMFVG User removed venue from group Venue Venue Group
REMU User deleted User Name Emai l
RENVG User renamed venue group Previ ous Venue Group New Venue Group
REST User restored booking Date/Time
UPDATE MI DAS updated New Version New Build Date
UPSI User updated i nvoice status I nvoi ce
http://mid.as/api P a g e | 46
API Documentation
Appendix B Setting Names
The following codes may be used in conjunction with the get_setting and "set_setting" calls. The "Settable"
column denotes which settings can be changed via the "set_setting" call.
Setting Description Example value Settable
api_version Current version of the MIDAS API 1.02
availability_include_pending If "1" MIDAS takes into account any
pending booking requests when checking
booking availability. If "0" confirmed
bookings can be made over provisional
booking slots
0
backup_email The email address that automated
database backups are sent to
backup@yourdomain.com
backup_last The time of the last backup (epoch
seconds)
1365609454
backup_persist The number of days to keep backups on
server
7
build_date Current MIDAS build date 1365608000
callto_enabled If "1" client phone/cell numbers become
clickable "callto" links within MIDAS
1
cron_enable_invoice_overdue If "1" automated invoice overdue
notifications are enabled
1
cron_enable_invoice_remind If "1" automated upcoming invoice
reminders are enabled
1
cron_enable_start_remind If "1" automated upcoming booking
reminders are enabled
1
cron_hour The hour (0-24) during which daily
scheduled tasks should run
11
cron_invoice_overdue The number of days after an unpaid
invoice was due to automatically send an
overdue notification to the client
7
cron_invice_remind The number of days before an unpaid
invoice is due to automatically send a
payment reminder to the client
3
cron_last The time that scheduled tasks were last
run (epoch second)
1407123529
cron_start_remind If "1" automated upcoming booking
reminders are enabled
1
datetime_amsymbol The symbol denoting the first 12 hours of
the day (when running in 12 hour clock
mode)
AM
datetime_datefirst If "1" dates are shown before times,
otherwise times are shown before dates
1
datetime_dateformat The date format DD/MM/YYYY
datetime_dtlink The link symbol between date and time @
datetime_gmtoffset The timezone's GMT offset 0
datetime_minterval The granularity of minutes 5
http://mid.as/api P a g e | 47
API Documentation
datetime_pmsymbol The symbol denoting the first 12 hours of
the day (when running in 12 hour clock
mode)
PM
datetime_startofweek The day that should be considered the
start of the week (0 = Sunday, 1 =
Monday, etc)
1
datetime_timeformat The time format HH:mm
datetime_timenow The current time (in epoch seconds) 1365696187
datetime_timezone The timezone Europe/London
datetime_ttlink The link symbol between two times -
email_bcc The email address that outgoing email
should be bcc'd to
bcc@yourdomain.com
email_sendfrom The email address that outgoing email
should appear sent from
midas@yourdomain.com
invoicing_counter The next invoice number to be generated 4
invoicing_createbydefault If "1" the "Create Invoice" option is
checked when adding bookings
0
invoicing_createifzero If "1" invoices will be created even if the
calculated invoice total is zero. If "0"
invoices will only be created if their
values are non-zero
1
invoicing_currencycode The currency code USD
invoicing_currencysymbol The currency symbol $
invoicing_decimalsep The decimal separator .
invoicing_includezero If "1" items will be included on invoices
even if their total value is zero. If "0"
invoices will only include items that have
an associated cost
1
invoicing_itemize_notes If "1" notes on invoices will be itemized
per booking. If "0" invoice notes will be
combined
1
invoicing_generate_notes The internal name of a booking field to
optionally include in the "notes" section
on generated invoices
notes
invoicing_no_booking_mod If "1" bookings from which invoices have
been generated can then no longer be
modified
0
invoicing_no_invoice_delete If "1" invoices cannot be
deleted/removed from the system until
they have been paid in full
0
invoicing_paypal_account Your PayPal email address paypal@yourdomain.com
invoicing_paypal_enabled If "1" online invoice payments are
allowed via PayPal
1
invoicing_pay_require_email If "1" clients are required to enter their
email address in order to view their
invoice online
1
invoicing_prefix The prefix that is added to all your
invoice numbers
MIDAS
invoicing_rounding If "1" invoice values are rounded up to 1
http://mid.as/api P a g e | 48
API Documentation
the nearest whole number 0
invoicing_silentdisc If "1" booking type discounts are applied
to invoices without any indication. If "0"
invoices will denote that a discount has
been applied
0
invoicing_tax The default tax percentage to be added
to invoices
0
invoicing_thousandsep The thousand separator ,
occupancy_max The maximum number of people allowed
on your site at any one time
510
occupancy_show Show the occupancy level when
adding/modifying bookings
1
occupancy_warn Warn if the number of people on site
exceeds this value
300
print_evactolerance When printing Emergency Evacuation
Data, this number reflects how many
minutes either side of the current time
the calculation of the number of people
on site should account for
15
print_sortby The booking field to sort booking print
outs by
start
print_sortdir The sort order of print outs (0 =
ascending, 1 = descending)
0
search_maxresults The maximum number of search results
to return per page
50
version Current MIDAS version 4.07
view_autoclose_alerts The number of seconds the "My
Messages" pop-up should display for, if
enabled by users
10
view_autoclose_notes The number of seconds after which any
"day notes" pop-ups should
automatically close
15
view_changemonthcell Allow users to choose what's displayed in
the monthly overview
1
view_cutoffdays The number of days to keep temporary
logs for
30
view_default The default view in the Booking Grid All
view_gridrowheight The height (in pixels) of each row in the
booking grid
30
view_gridvenuewidth The width (in pixels) of the first column
in the booking grid
100
view_showonblocks The booking field(s) to show on booking
"blocks" in the booking grid
organisation
view_showonmonthcell The booking field to show on dates in the
monthly overview
client
view_showontools The booking field(s) to show on tooltips
when hovering over booking "blocks" in
the booking grid
organisation
view_updatefrequency The number of seconds between 30
http://mid.as/api P a g e | 49
API Documentation
successive background data refreshes
view_viewsize The number of days to show in the
booking grid by default
1
webrequest_alloweddomains A comma separated list of email domains
from which booking requests are
permitted
@yourdomain.com,
@hotmail.com
webrequest_autoapprove If "1" booking requests are auto-
approved. If "0" booking requests must
be approved by an administrator
0
webrequest_blockcolor The color of existing booking blocks on
the public booking request screen
red
webrequest_disablepast The date (YYYYMMDD) past which
booking requests are not permitted
20141231
webrequest_enabled If "1" public booking requests are
enabled, if "0" public booking requests
are disabled
1
webrequest_leadintime The number of days in advance public
booking request must be made
7
webrequest_leadouttime The number of days in advance public
booking request are allowed to be made
for
14
webrequest_showcapacities If "1" selected venue's capacities are
shown during public booking requesting.
If "0" venue capacities are not revealed
to requestors
1
webrequest_showclosed If "1" selected venue's operating hours
are shown during public booking
requesting. If "0" operating hours are not
revealed to requestors
0
webrequest_showonblocks What information should be shown on
booking blocks in the public booking
request screen
times
http://mid.as/api P a g e | 50
API Documentation
Appendix C Error Handling
When making API calls, your applications should take into account possible errors that may be returned.
API errors will be returned in JSON format as follows:
Example Error Response
{"error":"error response"}
Error Response Meaning Applies To
"not enabled" API access is not enabled at this time. API access can be enabled
from within MIDAS via MIDAS Admin Options Manage Addons
API Access Enabled
All
"invalid api key" You have not supplied your API key in your call, or the API key
supplied is invalid
All
"GET method
not allowed. Use
POST instead"
An http GET request has been made to the API, but the API has
been set to accept http POST requests only. This setting may be
changed via MIDAS Admin Options Manage Addons API
Access Allow GET (as well as POST) method
All
"API running in
read only mode"
You have tried to make an API call that would result in changes
to data within MIDAS, yet the API is currently restricted to "read
only" mode. To make your call, you will first need to untick the
"Read only access" setting (MIDAS Admin Options Manage
Addons API Access)
add_*
approve_request
del_*
email_client
gen_invoice
mod_*
notify_user
reject_request
set_*
"no matches
found
No data was returned for the API call. Try broadening the search
parameters
get_activity
get_bookings
get_client
get_consuable_levels
get_invoice
get_invoices
get_messages
get_reminders
get_user
get_venues_in_group
get_watches
"protected
setting"
The setting you're trying to modify is read-only and cannot be
modified
set_setting
"referrer not
allowed"
The API call originates from a blocked domain/IP address.
Allowed domains/IP's may be specified from within MIDAS via
MIDAS Admin Options Manage Addons API Access
Allowed Referrers
All
"required
parameter
missing"
One or more parameters are required for the particular call
you're making is missing
All
"unknown
booking type"
Indicates that the specified booking type doesn't exist
del_bookings
get_bookings (when the type
parameter is specified)
"unknown
command"
The API command you've specified was unrecognized. Please
check you're using a valid command
All
http://mid.as/api P a g e | 51
API Documentation
"unknown
resource"
Indicates that the specified resource doesn't exist
get_resource_availabilit
y
"unknown
setting"
Indicates that the specified setting isn't recognized
get_setting
set_setting
"unknown
template"
Indicates that the specified template isn't recognized
get_template
set_template
"unknown user" Indicates that the specified user doesn't exist
get_activity
get_messeges
get_reminders
get_watches
"unknown
venue"
Indicates that the specified venue doesn't exist
del_bookings
get_availability
get_bookings (when the venue
parameter is specified)
get_venue
"unknown
venue group"
Indicates that the specified venue group doesn't exist
get_venues_in_group
http://mid.as/api P a g e | 52
API Documentation
Code Samples
jQuery
$.post("http://your_midas_url/api.pl", { key: "your_api_key", action:
"get_client", client: "Joe Bloggs" })
.done(function(response) {
alert("Response: " + response);
}, "JSON");
Perl
use LWP::UserAgent;
my$ua = LWP::UserAgent->new(env_proxy => 0,keep_alive => 0,timeout =>
30,agent =>'Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 5.0)');
my$r = $ua-
>post("http://your_midas_url/api.pl",[key=>"your_api_key",action=>"get_c
lient",client=>"Joe Bloggs"]);
if ($r->is_success) {
$response=$r->content;
}
PHP
$myvars = "key=your_api_key&action=get_client&client=Joe Bloggs";
$ch = curl_init("http://your_midas_url/api.pl");
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec( $ch );
http://mid.as/api P a g e | 53
API Documentation
Python
import urllib
import urllib2
parameters = {'key' : 'your_api_key',
'action' : 'get_client',
'client' : 'Joe Bloggs' }
data = urllib.urlencode(parameters)
req = urllib2.Request("http://your_midas_url/api.pl", data)
getresponse = urllib2.urlopen(req)
response = getresponse.read()
C#
using(WebClient client = new WebClient())
{
System.Collections.Specialized.NameValueCollection reqparm = new
System.Collections.Specialized.NameValueCollection();
parameters.Add("key", "your_api_key");
parameters.Add("action", "get_client");
parameters.Add("client", "Joe Bloggs");
byte[] responsebytes =
client.UploadValues("http://your_midas_url/api.pl", "POST", parameters);
string response = Encoding.UTF8.GetString(responsebytes);
}
http://mid.as/api P a g e | 54
API Documentation
Release Notes
V2.00
The API now allows bi-directional communication with MIDAS - meaning you can now
add/set/change data as well as reading it.
The following new API calls have been implemented:
add_booking
add_client
add_invoice
add_resource
approve_request
del_booking
del_bookings
del_client
del_invoice
del_resource
email_client
gen_invoice
get_booking
get_template
mod_booking
mod_client
mod_resource
notify_user
reject_request
restore_booking
set_setting
set_template
v1.03
20
th
March 2014 Added: "member_of" to the list of returned values for the "get_venue" call
Change: Format of "rates" information returned by "get_venue" call updated for MIDAS
v4.06
Fixed: "closed_from"/"closed_to" values from "get_venue" call may return 1/1/1970
v1.02
18
th
February 2014 Added: Support for multiple databases
v1.01
7
th
October 2013 Added: "get_venues_in_use" call
v1.00
1
st
June 2013 Initial API release
For the most up-to-date API documentation, please visit http://mid.as/api
http://mid.as/api P a g e | 55