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:
- get
- insert
- 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.
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.
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.