All docs This doc
Skip to end of metadata
Go to start of metadata


Overview

The following operations allow you to work with resources. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with resources, see Sample configuration

OperationDescription

checkResourceAvailability

Returns resource availability for the given time period.

createResourceAdds a new resource to your Planyo site.
listResourcesRetrieves resources defined in a Planyo site or meta site along with additional information and photos.

Operation details

This section provides further details on the operations related to resources.

Returning resource availability

The checkResourceAvailability operation returns resource availability for the given time period.

checkResourceAvailability
<planyo.checkResourceAvailability>
    <startTime>{$ctx:startTime}</startTime>
    <resourceId>{$ctx:resourceId}</resourceId>
    <quantity>{$ctx:quantity}</quantity>
    <sharingMode>{$ctx:sharingMode}</sharingMode>
	<endTime>{$ctx:endTime}</endTime>
</planyo.checkResourceAvailability>
Properties
  • startTime: The beginning of the rental duration.
  • resourceId: The ID of the resource.
  • quantity: The number of units.
  • sharingMode: Specifies the desired sharing mode (i.e. 1 = sharing not allowed, 1 = sharing allowed, 2 = sharing forced).
  • endTime: The end of the rental duration.
Sample request

Following is a sample REST/JSON request that can be handled by the checkResourceAvailability operation.

Sample Request for checkResourceAvailability
{
	"apiUrl":"http://api.planyo.com",
	"language":"EN",
	"apiKey":"45fd0acfee3f0388aeb8e7823179d21d",
	"version":1,
	"startTime":"2015-03-07 11:10",
	"resourceId":41456,
	"quantity":1,
	"sharingMode":1,
	"endTime":"2015-03-10 11:10"
}
Related Planyo documentation

https://www.planyo.com/api.php?topic=is_resource_available

Adding a new resource 

The createResource operation adds a new resource to your Planyo site.

createResource
<planyo.createResource>
    <durationDetails>{$ctx:durationDetails}</durationDetails>
    <availableUntil>{$ctx:availableUntil}</availableUntil>
    <isPublished>{$ctx:isPublished}</isPublished>
    <maxDaysToRental>{$ctx:maxDaysToRental}</maxDaysToRental>
    <baseResourceId>{$ctx:baseResourceId}</baseResourceId>
    <minRentalTime>{$ctx:minRentalTime}</minRentalTime>
    <resourceAdminId>{$ctx:resourceAdminId}</resourceAdminId>
    <minHoursToRental>{$ctx:minHoursToRental}</minHoursToRental>
    <name>{$ctx:name}</name>
    <availableFrom>{$ctx:availableFrom}</availableFrom>
    <images>{$ctx:images}</images>
    <quantity>{$ctx:quantity}</quantity>
    <startTimes>{$ctx:startTimes}</startTimes>
    <defaultPrice>{$ctx:defaultPrice}</defaultPrice>
    <resourceProperties>{$ctx:resourceProperties}</resourceProperties>
    <maxRentalTime>{$ctx:maxRentalTime}</maxRentalTime>
	<eventDates>{$ctx:eventDates}</eventDates>
</planyo.createResource>
Properties
  • durationDetails: Specifies predefined duration details in a JSON object containing duration property and a details sub object.
  • availableUntil: Overrides the base resource's setting "Available on working days until".
  • isPublished: Specifies whether the resource is published.
  • maxDaysToRental: Overrides the base resource's setting "Max. time between reservation and rental".
  • baseResourceId: The ID of the resource used as a base for the new resource.
  • minRentalTime: Overrides the base resource's minimum time between reservation and rental.
  • resourceAdminId: Overrides the base resource's resource admin ID.
  • minHoursToRental: Overrides the base resource's setting "Min. time between reservation and rental".
  • name: The name of the new resource being created.
  • availableFrom: Overrides the base resource's setting "Available on working days from".
  • images: The comma-separated full URLs of images.
  • quantity: The quantity of the new resource.
  • startTimes: Overrides the base resource's setting "Restrict starting times".
  • defaultPrice: Overrides the base resource's default price.
  • resourceProperties: Specifies the resource-specific properties in the JSON object.
  • maxRentalTime: Overrides the base resource's maximum time between reservation and rental.
  • eventDates: Specifies comma-separated start dates or start dates and times.
Sample request

Following is a sample REST/JSON request that can be handled by the createResource operation.

Sample Request for createResource
{	
	"apiUrl":"http://api.planyo.com",
	"apiKey":"794f56460a03fc193ffdf2c45725ad87",
	"version":1,
	"language":"EN",
	"durationDetails":{
					"duration":5,
					"details":{
						"predefined_duration_text_1":"TEXT_1",
						"predefined_duration_hours_1":11
					}
				   },
	"baseResourceId":41476,
	"name":"TEST7",
	"images":"http://www.brightlinkprep.com/wp-content/uploads/2014/04/sample.jpg",
	"quantity":5,
	"resourceProperties":{
						"prop_res_distance_to_sea":"testValue",
						"prop_res_no_of_children":250
					 }
}
Related Planyo documentation

https://www.planyo.com/api.php?topic=add_resource

Retrieving resources 

The listResources operation retrieves resources defined in a Planyo site or meta site along with additional information and photos.

listResources
<planyo.listResources>
    <detailLevel>{$ctx:detailLevel}</detailLevel>
    <page>{$ctx:page}</page>
    <pageSize>{$ctx:pageSize}</pageSize>
    <isListPublishedOnly>{$ctx:isListPublishedOnly}</isListPublishedOnly>
    <adminId>{$ctx:adminId}</adminId>
    <resourceFilterName>{$ctx:resourceFilterName}</resourceFilterName>
    <resourceFilterValue>{$ctx:resourceFilterValue}</resourceFilterValue>
	<resourceFilterValueInc>{$ctx:resourceFilterValueInc}</resourceFilterValueInc>
</planyo.listResources>
Properties
  • detailLevel: The indicator to return all resource information without resource-specific properties. Values: 1, 2, 4, or 8. Default: 1.
  • page: The page number to return. Default: 0.
  • pageSize: Results per page. Default: 100. Maximum: 300.
  • isListPublishedOnly: If "true", returns only published resources. Default: "false".
  • adminId: Filters the resources by providing the ID of the resource administrator. When this parameter is skipped, all resources will be returned.
  • resourceFilterName: The custom resource property filter name. Returns a subset of resources.
  • resourceFilterValue: The exact value of the custom resource property to be used together with resourceFilterName as the resource filter.
  • resourceFilterValueInc: Looks for values of the custom resource property which include the requested text.
Sample request

Following is a sample REST/JSON request that can be handled by the listResources operation.

Sample Request for listResources
{
	"apiUrl":"http://api.planyo.com",
	"apiKey":"d3314e7094e0ad10714156181eff0cf4",
	"version":1,
	"language":"EN",
	"detailLevel":2,
	"page":0,
	"pageSize":2,
	"isListPublishedOnly":true,
	"adminId":17231,
	"resourceFilterName":"RES_PROP_1",
	"resourceFilterValue":"My Value1",
}

Note

There are more optional parameters available. For more information on the usage of these parameters please check the API document. 

Related Planyo documentation

https://www.planyo.com/api.php?topic=list_resources

Sample configuration

Following is a sample proxy service that illustrates how to connect to Planyo with the init operation and use the checkResourceAvailability operation. The sample request for this proxy can be found in the checkResourceAvailability sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
	<proxy xmlns="http://ws.apache.org/ns/synapse" name="planyo_checkResourceAvailability" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
	 <target>
	 <inSequence>
      <property name="apiUrl" expression="json-eval($.apiUrl)"/>
      <property name="language" expression="json-eval($.language)"/>
      <property name="apiKey" expression="json-eval($.apiKey)"/>
      <property name="version" expression="json-eval($.version)"/>
      <property name="startTime" expression="json-eval($.startTime)"/>
      <property name="resourceId" expression="json-eval($.resourceId)"/>
      <property name="quantity" expression="json-eval($.quantity)"/>
      <property name="sharingMode" expression="json-eval($.sharingMode)"/>
      <property name="endTime" expression="json-eval($.endTime)"/>
      <planyo.init>
         <apiUrl>{$ctx:apiUrl}</apiUrl>
         <language>{$ctx:language}</language>
         <apiKey>{$ctx:apiKey}</apiKey>
         <version>{$ctx:version}</version>
      </planyo.init>
      <planyo.checkResourceAvailability>
         <startTime>{$ctx:startTime}</startTime>
         <resourceId>{$ctx:resourceId}</resourceId>
         <quantity>{$ctx:quantity}</quantity>
         <sharingMode>{$ctx:sharingMode}</sharingMode>
         <endTime>{$ctx:endTime}</endTime>
      </planyo.checkResourceAvailability>
	   <respond/>
	 </inSequence>
	  <outSequence>
	   <send/>
	  </outSequence>
	 </target>
   <description/>
  </proxy>                                                                                                                                               
  • No labels