PHP code example of floorplanner / roomstyler-api-php
1. Go to this page and download the library: Download floorplanner/roomstyler-api-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
floorplanner / roomstyler-api-php example snippets
read all public data
$rsapi = new RoomstylerApi();
read all public data
# can perform actions on rooms such as placing a comment or toggling a like
$rsapi = new RoomstylerApi(['user' => ['name' => 'myusername', 'password' => 'mypassword']]);
read all public data
# can read all whitelabel data
$rsapi = new RoomstylerApi(['whitelabel' => ['name' => 'mywhitelabel', 'password' => 'mywhitelabelpassword']]);
read all public data
# can read all whitelabel data
# can perform actions on rooms such as placing a comment or toggling a like
$rsapi = new RoomstylerApi(['user' => ['name' => 'myusername', 'password' => 'mypassword'],
'whitelabel' => ['name' => 'mywhitelabel', 'password' => 'mywhitelabelpassword']]);
#call to a new instance of "RoomstylerRoomMethods"
$api->rooms;
#call to a new instance of "RoomstylerComponentMethods"
$api->components;
$api = new RoomstylerApi(['user' => $CONFIG['user_credentials']]);
$user = $api->user->find(972691);
echo '<pre>';
print_r($user);
# =>
RoomstylerUser Object
(
[_http_status:RoomstylerModelBase:private] => 200
[_accessible_props:RoomstylerModelBase:private] => ['errors']
[errors:RoomstylerModelBase:private] => RoomstylerError Object
(
)
[_settings:protected] => Array
(
[protocol] => https
[whitelabel] => Array
(
)
[user] => Array
(
[name] => [email protected]
[password] => mysignin_password
)
[host] => roomstyler.com
[prefix] => api
[token] => 64f97c9ee52df2735fsample-tokene6e252d58837d41b05cd
[timeout] => 5
[language] => en
[connect_timeout] => 30
[request_headers] => Array
(
[0] => Content-Type: application/json; charset=utf-8
)
[debug] =>
[user_agent] => RoomstylerApi/1.0 Type/normal (https://roomstyler.com)
)
[_whitelabeled:protected] =>
[id] => 972691
[username] => Sidney Liebrand
[role] => admin
[bio] => I'm a 21 year old web developer from the Netherlands, born, raised and still living in the always magnificent Dinteloord.
[avatar] => https://d2sdvaauesfb7j.cloudfront.net/avatars/972691-1434979777.jpg
[background] => https://d2sdvaauesfb7j.cloudfront.net/img/empty.jpeg
)
$response = $rsapi->rooms->index(['limit' => 100]);
# full response
# since the API call errored, a single object is returned instead of an array of objects.
print_r($response);
# if this didn't happen, you'd have to call
print_r($response[0]);
# to see the errors (which are always bound to every returned object)