Updates - Update existing content

The following will update 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 update 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 set to update particular fields.
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
id The id parameter is used to specify which item should be updated. This can be obtained through a GET API call.

All updates require the id to be sent along with the accessKey, method and type which are all 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.
    • message - This will only be set if update was successful.
  • body - In this case is an empty array.
NOTE: Be aware that all variables are case-sensitive.

Contact

Update a contact
Vars Type Notes
email String The contact's email.
fname String The contact's first name.
lname String The contact's last name.
phone String The contact's phone number.
organisation String The organisation that the contact is associated with.
role String The role in the organisation that the contact is associated with.

Contact Property Information

Update a contact's generic property information.
Vars Type Notes
postal String The address must be in the following format:
{Street Number} {Street Name} {Street Type}, {Suburb}, {State} {Post Code} [{Country}]
Where Country is optional.
invoiceFreq String The property's invoice frequency. Accepted values are:
  • day
  • week
  • fortnight
  • month
  • FOM
NOTE: FOM = First of Month. All values are case sensitive.

Employee

Update a employee
Vars Type Notes
email String The employee's email.
name String The employee's name.
team String The employee's team.
affiliation String The employee's affiliation to the company.
role String The employee's role within a team.
confirmed String
  • 'true' - makes employee green in the roster.
  • 'false' - makes employee purple in the roser.
  • 'hol' - makes employee orange in the roster.
  • 'sick' - makes employee blue in the roster.

Equipment

Update a equipment
Vars Type Notes
item String The equipment's name

Invoice

Update an invoice
Vars Type Notes
service String The service for the invoice.
invoiceDate date The date the invoice was created on.
dueDate date The the invoice should be paid by.
amount float The amount the invoice is for.
owing float The amount owing on the invoice.
filename String The filename for the invoice.
file Base64 String Both filename and file must be entered to upload an invoice file. The file must be a Base64 String, this is the same as inserting an invoice.

Item

Update a item
Vars Type Notes
item String The item's name.
price float The item's price.
fixedPrice String 'true' if the price should not be multiplied by the amount of hours worked. Only used if the item is a service.

Job

Insert a new Job
Vars Type Req? Notes
address String Yes The address the job is for, the address must be in the following format:
{Street Number} {Street Name} {Street Type}, {Suburb}, {State} {Post Code} [{Country}]
Where Country is optional.
service String Yes The service for the job, this must be a valid service please see here for a list of valid services.
hours float Yes The hours required to complete the job.
team String No The team name that will be completing the job.
notes String No This visit only notes for the job. These should not be entered if the job is going to reoccur.
seriesNotes String No Every visit notes for the job.
confirmed String No A value of 'true' will turn the job green in the Calendar.
scope String No The scope of works for the job.
watchSymbol String No A value of 'true' will put a watch symbol on the job indicating it should be done at the specified time.
key int No The id for the key that goes with this job.

Key

Update a Key
Vars Type Notes
key String The description/name of the key.

Quote

Insert a new quote
Vars Type Notes
address String The address the job is for, the address must be in the following format:
{Street Number} {Street Name} {Street Type}, {Suburb}, {State} {Post Code} [{Country}]
Where Country is optional.
service String The service must be a valid service, please see here for a list of valid services.
assignTo String An employee's email address that should be assigned to complete the quote.
notes String Any notes about/for the quote.
confirmed String A value of 'true' will turn the quote green in the Calendar.
templateId int The id for the pdf template to be used.

Role

Update a role
Vars Type Notes
role String The role's name.
priority String The priority of the role, the lower the number the sooner it will be assigned to a team member.

Scope

Update a scope
Vars Type Notes
scope String The scope for the service.

Team

Update a team
Vars Type Notes
team String The team's name.
subcontracted String A value of 'true' is used if the team is a subcontractor.

Recurring Patterns

This is a special alphanumeric string, it is structured as:
[type]_[interval]_[day]_[interval2]_[days]#extra

Try experimenting with the following code to generate recurring patterns:
HTML:
<div class='dhx_form_repeat' id='repeatForm' style='height:140px;width:95%;margin-left:2%;margin-top:8px;margin-bottom:5px;'>
<form>
<div class='dhx_repeat_left'>
<label>
<input class='dhx_repeat_radio' type='radio' name='repeat' value='day' />Daily
</label><br />
<label>
<input class='dhx_repeat_radio' type='radio' name='repeat' value='week'/>Weekly
</label><br />
<label>
<input class='dhx_repeat_radio' type='radio' name='repeat' value='month' checked />Monthly
</label><br />
<label>
<input class='dhx_repeat_radio' type='radio' name='repeat' value='year' />Yearly
</label><br />
<label>
<input class='dhx_repeat_radio' type='radio' name='repeat' value='seasonal' />Seasonal
</label>
</div>
<div class='dhx_repeat_divider' id='leftDivider'></div>
<div class='dhx_repeat_center'>
<div style='display:none;' id='dhx_repeat_day'>
<label>
<input class='dhx_repeat_radio' type='radio' name='day_type' value='d'/>Every
</label>
<input class='dhx_repeat_text' type='text' name='day_count' value='1' />day
<br />
<label>
<input class='dhx_repeat_radio' type='radio' name='day_type' checked value='w'/>Every workday
</label>
</div>
<div style='display:none;' id='dhx_repeat_week'>
Repeat every<input class='dhx_repeat_text' type='text' name='week_count' value='1' />week next days:<br />
<table class='dhx_repeat_days'>
<tr>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='1' />Monday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='4' />Thursday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='2' />Tuesday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='5' />Friday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='3' />Wednesday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='6' />Saturday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week_day' value='0' />Sunday
</label><br /><br />
</td>
</tr>
</table>
</div>
<div id='dhx_repeat_month'>
<label>
<input class='dhx_repeat_radio' type='radio' name='month_type' value='d'/>Repeat every
</label>
<input class='dhx_repeat_text' type='text' name='month_day' value='1' />day of every
<input class='dhx_repeat_text' type='text' name='month_count' value='1' />month<br />
<label>
<input class='dhx_repeat_radio' type='radio' name='month_type' checked value='w'/>On every
</label>
<input class='dhx_repeat_text' type='text' name='month_week2' value='1' />
<select name='month_day2'>
<option value='1' selected >Monday
<option value='2'>Tuesday
<option value='3'>Wednesday
<option value='4'>Thursday
<option value='5'>Friday
<option value='6'>Saturday
<option value='0'>Sunday
</select>
of every<input class='dhx_repeat_text' type='text' name='month_count2' value='1' />month<br />
</div>
<div style='display:none;' id='dhx_repeat_year'>
<label>
<input class='dhx_repeat_radio' type='radio' name='year_type' value='d'/>Every
</label>
<input class='dhx_repeat_text' type='text' name='year_day' value='1' />day of
<select name='year_month'>
<option value='0' selected >January
<option value='1'>February
<option value='2'>March
<option value='3'>April
<option value='4'>May
<option value='5'>June
<option value='6'>July
<option value='7'>August
<option value='8'>September
<option value='9'>October
<option value='10'>November
<option value='11'>December
</select>
month<br />
<label>
<input class='dhx_repeat_radio' type='radio' name='year_type' checked value='w'/>On
</label>
<input class='dhx_repeat_text' type='text' name='year_week2' value='1' />
<select name='year_day2'>
<option value='1' selected >Monday
<option value='2'>Tuesday
<option value='3'>Wednesday
<option value='4'>Thursday
<option value='5'>Friday
<option value='6'>Saturday
<option value='7'>Sunday
</select>
of
<select name='year_month2'>
<option value='0' selected >January
<option value='1'>February
<option value='2'>March
<option value='3'>April
<option value='4'>May
<option value='5'>June
<option value='6'>July
<option value='7'>August
<option value='8'>September
<option value='9'>October
<option value='10'>November
<option value='11'>December
</select><br />
</div>
<div style='display:none;' id='dhx_repeat_seasonal'>
Repeat every<input class='dhx_repeat_text' type='text' name='week2_count' value='1' />week on days:<br />
<table class='dhx_repeat_days'>
<tr>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='1' />Monday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='4' />Thursday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='2' />Tuesday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='5' />Friday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='3' />Wednesday
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='6' />Saturday
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='week2_day' value='0' />Sunday
</label><br /><br />
</td>
</tr>
</table><br />
During the months:<br />
<table class='dhx_repeat_days'>
<tr>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='0' />January
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='4' />May
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='8' />September
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='1' />February
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='5' />June
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='9' />October
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='2' />March
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='6' />July
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='10' />November
</label>
</td>
<td>
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='3' />April
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='7' />August
</label><br />
<label>
<input class='dhx_repeat_checkbox' type='checkbox' name='month3_day' value='11' />December
</label>
</td>
</tr>
</table>
</div>
</div>
<div class='dhx_repeat_divider' id='rightDivider'></div>
<div class='dhx_repeat_right' style='width:140px;margin-top:-5px;'>
<label>
<input class='dhx_repeat_radio' type='radio' name='end' checked/>No end date
</label><br />
<label>
<input class='dhx_repeat_radio' type='radio' name='end' />End after
</label>
<input class='dhx_repeat_text' type='text' name='occurences_count' value='1' />occurrences<br />
<label>
<input class='dhx_repeat_radio' type='radio' name='end' />End by
</label>
<input class='dhx_repeat_date' style='width:90%;' type='text' name='date_of_end' value='
scheduler.config.repeat_date_of_end
' /><br />
</div>
</form>
</div>
<div style='clear:both'> </div>
Select All

CSS:
.dhx_repeat_right{margin-right:55px;}
div.dhx_form_repeat input.radio{margin:-4px 0 0 -4px!ie;}
div.dhx_form_repeat input.checkbox{margin:0 0 0 -4px!ie;}
.dhx_form_repeat,.dhx_form_repeat input{padding:0;margin:0;padding-left:5px;font-family:Tahoma,Verdana;font-size:11px;line-height:24px;}
.dhx_form_repeat{overflow:hidden;height:0;background-color:#FFF4B5;}
.dhx_cal_light_wide .dhx_form_repeat{background-color:transparent;}
.dhx_repeat_center,.dhx_repeat_left{height:115px;padding:10px 0 10px 10px;float:left;}
.dhx_repeat_left{width:95px;}.dhx_repeat_center{width:335px;margin-top:12px;}
.dhx_repeat_divider{float:left;height:115px;border-left:1px dotted #DCC43E;width:1px;}
.dhx_repeat_right{float:right;height:115px;width:160px;padding:10px 3px 10px 10px;margin-top:7px;}
input.dhx_repeat_text{height:16px;width:27px;margin:0 4px 0 4px;line-height:18px;padding:0 0 0 2px;}
.dhx_form_repeat select{height:20px;width:87px;padding:0 0 0 2px;margin:0 4px 0 4px;}
input.dhx_repeat_date{height:18px;width:80px;padding:0 0 0 2px;margin:0 4px 0 4px;background-repeat:no-repeat;background-position:64px 0;border:1px #7f9db9 solid;line-height:18px;}
input.dhx_repeat_radio{margin-right:4px;}
input.dhx_repeat_checkbox{margin:4px 4px 0 0;}
.dhx_repeat_days td{padding-right:5px;}
.dhx_repeat_days label{font-size:10px;}
.dhx_custom_button{width:90px;-webkit-border-radius:4px;-moz-border-radius:4px;-ms-border-radius:4px;-o-border-radius:4px;border-radius:4px;}
.dhx_custom_button_recurring{background-image:url(./imgs/but_repeat.gif);background-position:-5px 20px;width:20px;margin-right:10px;}
.dhx_cal_light_rec{width:640px;}
.dhx_cal_light_rec .dhx_cal_larea{width:632px;}
.dhx_cal_light_rec.dhx_cal_light_wide{width:816px;}
.dhx_cal_light_rec.dhx_cal_light_wide .dhx_cal_larea{width:808px;}
Select All

Using the variables from the code above the 5 parameters for a recPattern are then as follows:
[repeat]_
[day_count/week_count/month_count/month_count2/year_day/year_week2/week2_count]_
[month_day2/year_day2/month3_day]_
[month_week2/year_week2]_
[week_day/week2_day]#
extra
The extra component is:
  • 'no' - if no end date is selected. The end date should then be set to something ridiculous e.g. 00:00:00 31-12-9999
  • The number of occurrences that was entered to end after. eg '2'. In this case the endDate parameter is set to be equal to the start date.
  • If an end is specified then nothing is entered after the #, and the endDate should be set to be the same as the end date entered.
NOTES:
month_day sets the day component of the start date.
year_month2 sets the month component of the start date.
year_day and year_month set the day and month components of the start_date.
Any daily or yearly recurring pattern must have the first 2 parameters as 'day_1' or 'year_1' respectively then continue with the rest of the pattern.

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