Gets - Retrieve your information

The following will retrieve information relating to the parameters that are passed to the API.
To use the API for getting contractor information call the following link:
https://samepage.com.au/api/contractor
With the required POST variables and any additional variables you require.
For any API call the following variables must be posted:
Variable Info
accessKey The access key can be obtained through the Admin page in the section at the top of the right column called "API Access Key".
method Method specifies what the API should be aiming to achieve with the posted data. The three options are:
  1. get
  2. insert
  3. update
In this case use get for anything mentioned below.
type The type parameter is a further definition of what the API should be aiming to achieve with the posted data.
These will be outlined in more detail below, as each type has it's own list of variables that can be additionally sent to further refine the search.
format The format parameter tells the API how you want the data returned. The default return value is json if this parameter is not set.
  • json
  • php
NOTE: The returned php is a sanatized string

To return everything for a particular GET simply pass it no additional parameters (accessKey, method and type are the only required parameters).
All returned data is order as follows:
  • head =>
    • status - This will be a 1 if successful, 0 if an error has occurred, 2 if a warning occurred.
    • error_number - This will be a numeric error value and is only set if status is not 1.
    • error_message - This will be a String outlining what went wrong and is only set if status is not 1.
  • body - This holds an Array of all the results.
NOTE: Be aware that all variables are case-sensitive.

Contacts

Returns the list of contacts information for the property based on the variables sent to the API. One of the following must be sent
Vars Type Info
id int If an id is specified only the key with the corresponding id will be returned.
organisation String The organisation the contact is associated with.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the property's contact information.
email String The email address for the contact.
first_name String The first name of the contact.
last_name String The last name of the contact.
phone String The phone number for the contact.
organisation String The organisation associated with the contact.
role String The contacts role (this can be their role within the organisation, e.g. Assistant).

Contacts Property Information

Returns the list of contact information generic for the property and your company based on the variables sent to the API. Only a single variable should be sent
Vars Type Info
id int If an id is specified only the key with the corresponding id will be returned.
address String A partial address for the property. This can be used in conjunction with service to further define the search.
invoiceFreq String The invoice frequency for the property. Accepted values are:
  • day
  • week
  • fortnight
  • month
  • FOM
NOTE: FOM = First of Month. All values are case sensitive.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the property's contact information.
address String The address.
postal String The postal address.
invoiceFreq String The frequency at which invoices should be sent to the property.
propertyName String This could be a strata number or name of the property. Some additional identifier (optional).

Employees

Returns the list of employees associated for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the employee with the corresponding id will be returned.
name String Only a partial name is needed and a compartive search will check to see if the matches any part of an employee's name.
email String An employee's email/username.
parentId int Used to retrieve another part of the series, setting this to 0 will only return series' and no occurrences made.
admin boolean Employees that have increased access to SamePage are classed as Admins, which results in this value being set to 1.
team String The team an employee is in.
affiliation String The employees affiliation with the company
role String The role the employee has within a team
date date Searches for any employees that worked on a specified date.
afterDate boolean Only considered when used in conjunction with date. Searches for any employees that worked on the specified date, or any time in the future.
beforeDate boolean Only considered when used in conjunction with date. Searches for any employees that worked before the specified date.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the employee.
name String The employee's name.
email String The employee's email.
start_date datetime The employee's start date.
end_date datetime The employee's end date.
rec_type String The employee's rec_type is a special pattern that dictates how it should repeat. This pattern is broken down into
[type]_[interval]_[day]_[interval2]_[days]#extra

where:
  • type - the repetition type: 'day', 'week', 'month', 'year', 'seasonal'.
  • interval - the time between each repetition.
  • day & interval2 - used to define a day of a month. Except when type is 'seasonal' then day defines a comma-seperated list of the months that can be repeated in.
  • days - comma-separated list of days that can be repeated on.
  • extras - extra info that can be used to change the presentation of recurring details.
In the event of consecutive underscores this simply means a parameter is not being used for that particular recurrence.
parentId int The id for the parent of the series, if this is 0 then the result is already the start of the series.
admin boolean A 1 if an employee is an admin of the company, which allows for enhanced usabillity of SamePage, 0 if they are a normal employee.
confirmed String If an employee is confirmed they will appear green on the Roster, values for this field are:
  • 'true' - Employee appears green
  • 'false' - Employee appears purple
  • 'hol' - Employee appears orange
  • 'sick' - Employee appears light blue
team String The team the employee is assigned to.
affiliation String The employee's affiliation to the company.
role String The employee's role within the team.
Examples:
The following code will get all the employees with 'Alex' in their names and are admins.
Format Code
php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://samepage.com.au/api/contractors");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
"accessKey" => $myApiKey,
"format" => "php",
"method" => "get",
"type" => "employees",
"name" => "Alex",
"admin" => "1"
)));
$server_output = curl_exec($ch);
echo "<pre>";
print_r(unserialize($server_output));
echo "</pre>";
curl_close($ch);
jQuery
$.ajax({
url: "https://samepage.com.au/api/contractors",
type: "POST",
dataType: "json",
data: { "accessKey":"myApiKey", "format":"json", "method":"get", "type":"employees", "name":"Alex", "admin" => "1"},
success: function(data) {
console.log(data);
}
});

Equipment

Returns the list of equipment for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the item with the corresponding id will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
item String The item's name/description
Examples:
The following code will get all the equipment for a contractor and then output it to the screen.
Format Code
php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://samepage.com.au/api/contractors");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
"accessKey" => $myApiKey,
"format" => "php",
"method" => "get",
"type" => "equipment"
)));
$server_output = curl_exec($ch);
echo "<pre>";
print_r(unserialize($server_output));
echo "</pre>";
curl_close($ch);
jQuery
$.ajax({
url: "https://samepage.com.au/api/contractors",
type: "POST",
dataType: "json",
data: { "accessKey":"myApiKey", "format":"json", "method":"get", "type":"equipment"},
success: function(data) {
console.log(data);
}
});

Equipment Used

Returns the list of equipment and the id for the job it belongs to.
Vars Type Info
id int If an id is specified only the item with the corresponding id will be returned.
jobId int If a jobId is specified than all equipment used/required for the job will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
jobId int The job's id that this item was/will be used in.
item String The item's name/description
quantity Float The amount required.

Invoices

Returns the list of invoices. Due to the sheer number of invoices that are stored pagination is required, therefor the 'pagenum' and 'displayAmount' are required.
Vars Type Info
id int If an id is specified only the item with the corresponding id will be returned.
propertyId int If a propertyId is specified then all invoices for that property will be returned.
service String The service the invoice was for. Returns all invoices for the service.
pagenum int The page number to get. This is required.
displayAmount int The amount of invoices per page. Max of 700. This is required.
invoiceDate date The date the invoice was created. Returns all invoices on the date.
dueDate date The date the invoice is due. Returns all invoices on the date.
afterDate boolean Only considered when used in conjunction with invoiceDate or dueDate. Returns all invoices on or after the date specified.
beforeDate boolean Only considered when used in conjunction with invoiceDate or dueDate. Returns all invoices before the date specified.
amount float The invoiced amount.
owing float The amount still owing.
overCost boolean Only considered when used in conjunction with amount or owing. Returns all invoices with amount/owing above or equal to the value specified.
underCost boolean Only considered when used in conjunction with amount or owing. Returns all invoices with amount/owing below the value specified.
uploadedBy String The username of an employee, this will return all invoices uploaded by this employee.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the invoice.
propertyId int The propertyId for the invoice.
service String The service for the invoice.
invoiceDate date The date the invoice was created on.
dueDate date The date the invoice is due.
amount float The amount the invoice is for.
owing float The amount still owing on the invoice
uploadedBy String The username of the employee that uploaded the invoice.
filename String The partial filename for an invoice. For the complete filename use the following structure:
'https://samepage.com.au/uploads/strata/'+propertyId+'/invoices/'+filename
notEditable Float If this value is 'true' then the invoice has been uploaded via an accounting package and can only be edited through the accounting package.

Invoice Status

Returns data on completed jobs which outlines if they have been invoiced or not, and what day they were started on.
Any combination can be used to search for the status of a job.
Vars Type Info
id int If an id is specified only the item with the corresponding id will be returned.
address String Only a partial address needs to be entered and a comparitive search will be performed to find any addresses matching this variable
service String Any service can be entered to search for all potential matches to the service.
invoice_ready String 'true' will return any jobs that have been marked as ready to be invoiced.
generated_invoice String 'true' will return any jobs that have already had an invoice created.
jobId int This id links the data back to the original job.
date date The start date of the job. This will search for any jobs on the date specified
afterDate boolean Only considered if a date has been entered. This extends the date search to include anything on the specified date or in the future of it.
beforeDate boolean Only considered if a date has been entered. This extends the date search to only search for jobs before the specified date.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
address String The job's address
service String The job's service.
start_date datetime The start date of the job
generated_invoice String "true" or "false" to determine if the job has been invoiced.
invoice_ready String "true" or "false" to determine if the job is ready to be invoiced.
jobId int The id to link to the actual job event.
Examples:
The following code will get all the jobs that are ready to be invoiced but haven't had an invoice created yet.
Format Code
php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://samepage.com.au/api/contractors");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
"accessKey" => $myApiKey,
"format" => "php",
"method" => "get",
"type" => "invoiceStatus",
"invoice_ready" => "true",
"generated_invoice" => "false"
)));
$server_output = curl_exec($ch);
echo "<pre>";
print_r(unserialize($server_output));
echo "</pre>";
curl_close($ch);
jQuery
$.ajax({
url: "https://samepage.com.au/api/contractors",
type: "POST",
dataType: "json",
data: { "accessKey":"myApiKey", "format":"json", "method":"get", "type":"invoiceStatus", "invoice_ready":"true", "generated_invoice":"false"},
success: function(data) {
console.log(data);
}
});

items

Returns the list of items.
Vars Type Info
id int If an id is specified only the item with the corresponding id will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
item String The item's name/description
price Float The cost of the item.
fixed_price String "true" or "false" to determine if the item price should be multiplied by hours worked (this only applies to services).

Jobs

Returns the list of jobs created by your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the job with the corresponding id will be returned.
address String Only a partial address is needed and a comparitive search is taken to check if the piece of address matches any other addresses.
service String The service the job is for.
parentId int Search for other jobs in the series.
employee String The employee's email address that is undertaking the job.
date date The date the quote is on, this searches only for jobs on the date specified.
afterDate boolean Only considered if a date has been entered. This extends the search to include the date specified and any jobs in the future.
beforeDate boolean Only considered if a date has been entered. This extends the search to only search for jobs before the specified date.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the job.
start_date datetime The start date for the job.
end_date datetime The end date for the job.
address String The job's address.
rec_type String The job's rec_type is a special pattern that dictates how it should repeat. This pattern is broken down into
[type]_[interval]_[day]_[interval2]_[days]#extra

where:
  • type - the repetition type: 'day', 'week', 'month', 'year', 'seasonal'.
  • interval - the time between each repetition.
  • day & interval2 - used to define a day of a month. Except when type is 'seasonal' then day defines a comma-seperated list of the months that can be repeated in.
  • days - comma-separated list of days that can be repeated on.
  • extras - extra info that can be used to change the presentation of recurring details.
In the event of consecutive underscores this simply means a parameter is not being used for that particular recurrence.
parentId int The parent's job id, this will be 0 if the job is either the start of a series or is not a part of a series at all.
team String The team name/description that will undertake the job.
notes String Any notes for this visit only.
series_notes String Any "every visit" notes for the job.
field_notes String Any field notes for the job.
confirmed String Shows if the job has been confirmed, a value of 'true' means the job appears green in the Calendar.
service String The service for the job.
scope String The work scope for the job.
hours float The estimated amount of time the job will take.
watch_symbol String Defines if the job should be flaged with the watch symbol, a value of 'true' will be set if the symbol is present.
key_id int The id for the key that is required. If no key is set this value will be 0, if a key is set a key symbol will also be placed on the job.
invoice_frequency String Outlines how often the job is set to be invoiced.
phone String The email address of the person who is to be contacted about the job.
phone_before String A string outlining how long before the job the contact should be phoned.
alert_email String Only returned if calendar alerts is purchased. An email address for the person who should be alerted prior to this job.
alert_before String A string outlining how long before the job the alert should be sent out.
alert_via String The method the alert is to be sent by.

Keys

Returns the list of keys for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the key with the corresponding id will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
key String The key's name/description

Prices

Returns a price list of all the add ons
This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the add on.
add_on String The add on's name/description.
price float The price of the add on.

Properties List

Returns the list of properties associated with your company based on the variables sent to the API
Vars Type Info
id String If an id is specified only the property with the corresponding id will be returned.
address String Only a partial address is needed and a comparitive search will be preformed to find all matches to the address.

This results in the following array of variables returned for each match:
Vars Type Info
id String The id for the property.
address String The address of the property.
property_name String The properties name/description.

Quantity

Returns the list of items and the amount used for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the quantity with the corresponding id will be returned.
jobId int If a jobId is specified all quantities for the job will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
jobId int The id to link to the job this item was used in.
item String The item's name/description.
amount float The quantity used.

Quotes

Returns the list of quotes created by your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the quote with the corresponding id will be returned.
address String Only a partial address is needed and a comparitive search is taken to check if the piece of address matches any other addresses.
service String The service the quote is for.
employee String The employee's email address that is undertaking the quote.
status String The status of the quote.
date date The date the quote is on, this searches only for quotes on the date specified.
afterDate boolean Only considered if a date has been entered. This extends the search to include the date specified and any quotes in the future.
beforeDate boolean Only considered if a date has been entered. This extends the search to only search for quotes before the specified date.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the quote.
start_date datetime The date the quote was for.
address String The quote's address.
service String The service for the quote.
employee String The employee's email address that is assigned to complete the quote.
notes String Any notes for the quote.
templateId String The template id used for the quote.
status String The current status of the quote.
Examples:
The following code will get all the quotes for 'Gardening' that are before the specified date.
Format Code
php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://samepage.com.au/api/contractors");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(
"accessKey" => $myApiKey,
"format" => "php",
"method" => "get",
"type" => "quotes",
"service" => "Gardening",
"date" => "21-11-2024",
"beforeDate" => "1"
)));
$server_output = curl_exec($ch);
echo "<pre>";
print_r(unserialize($server_output));
echo "</pre>";
curl_close($ch);
jQuery
$.ajax({
url: "https://samepage.com.au/api/contractors",
type: "POST",
dataType: "json",
data: { "accessKey":"myApiKey", "format":"json", "method":"get", "type":"quotes", "service":"Gardening", "date":"21-11-2024", "beforeDate":"1"},
success: function(data) {
console.log(data);
}
});

Roles

Returns the list of roles for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the role with the corresponding id will be returned.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
role String The role's name/description
priority int The role's priority, the lower the number the sooner it will be assigned to a team member.

Scope of Work

Returns the list of premade scopes for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the scope with the corresponding id will be returned.
service String The service of the work scope.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the property.
service String The service the scope is for.
scope String The scope itself.

Services

Returns the list of services associated for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the service with the corresponding id will be returned.
service String Search for any mataches to a particular service.
contact String A contractor's contact email.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the property.
service String The service the result is for.
contact String The contactor's email that is the contact for the service at the property.

Teams

Returns the list of teams for your company based on the variables sent to the API
Vars Type Info
id int If an id is specified only the key with the corresponding id will be returned.
subcontracted String Specifies to search for only teams that are classed as subcontractors.

This results in the following array of variables returned for each match:
Vars Type Info
id int The id for the item.
team String The team's name/description.
subcontracted String If subcontracted this value will be 'true'.

Services List

For a constantly updated list use a 'get' query to the API with the type 'serviceList'. Otheriwse the following is a list of all the valid services:
  1. Air Conditioning
  2. Antennas
  3. Appliances
  4. Bins In
  5. Bins Out
  6. Blinds and Awnings
  7. Blowing
  8. Building Management
  9. Carpet Cleaning
  10. Construction
  11. Cleaning
  12. Doors and Windows
  13. Electricals
  14. Fencing
  15. Fire Safety
  16. Gardening
  17. Generators
  18. Glazing
  19. Gutter Cleaning
  20. Handyman Tasks
  21. Hard Landscaping
  22. Irrigation
  23. Lawn Mowing
  24. Lifts
  25. Locks
  26. Painting
  27. Paving
  28. Pest Control
  29. Plumbing
  30. Pool Cleaning
  31. Pool Repairs
  32. Pressure Washing
  33. Roofing and Guttering
  34. Rubbish Removal
  35. Sailmaking
  36. Security
  37. Signage
  38. Soft Landscaping
  39. Telecommunications
  40. Tennis Court Repairs
  41. Tiling
  42. Tools Maintenance
  43. Tree Lopping
  44. Waste Management
  45. Waterproofing