Skip to content

SUPLA/api-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SUPLA API Client for PHP

Latest Release Build Status Packagist Downloads

Your home connected. www.supla.org

Installation

Requires PHP 7.3 or later.

Install with Composer.

Getting Started

<?php
require_once(__DIR__ . '/vendor/autoload.php');

use Supla\ApiClient\Api\ChannelsApi;
use Supla\ApiClient\Model\ChannelFunctionEnumNames;

// Get access token from OAuth flow or use a Personal Access Token
$accessToken = '<YOUR_ACCESS_TOKEN_HERE>';
$config = Supla\ApiClient\Configuration::getDefaultConfiguration()->setAccessToken($accessToken);

$apiInstance = new ChannelsApi( new GuzzleHttp\Client(), $config);

try {
    $result = $apiInstance->getChannels([ChannelFunctionEnumNames::LIGHTSWITCH]);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SUPLA API: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://YOUR_SUPLA_SERVER/api/v3.

Class Method HTTP request Description
AccessIdentifiersApi createAccessIdentifier POST /accessids Create a new Access Identifier
AccessIdentifiersApi deleteAccessIdentifier DELETE /accessids/{id} Delete the access identifier
AccessIdentifiersApi getAccessIdentifier GET /accessids/{id} Get AID by ID
AccessIdentifiersApi getAccessIdentifiers GET /accessids Get Access Identifiers
AccessIdentifiersApi updateAccessIdentifier PUT /accessids/{id} Update the access identifier
ChannelGroupsApi createChannelGroup POST /channel-groups Create a new channel group
ChannelGroupsApi deleteChannelGroup DELETE /channel-groups/{id} Delete the channel group
ChannelGroupsApi executeActionOnChannelGroup PATCH /channel-groups/{id}
ChannelGroupsApi getChannelGroup GET /channel-groups/{id} Get Channel Group
ChannelGroupsApi getChannelGroupDirectLinks GET /channel-groups/{channelGroup}/direct-links Get channel group direct links
ChannelGroupsApi getChannelGroupScenes GET /channel-groups/{channelGroup}/scenes Get channel group scenes
ChannelGroupsApi getChannelGroups GET /channel-groups Get Channel Groups
ChannelGroupsApi updateChannelGroup PUT /channel-groups/{id} Update the channel group
ChannelsApi configureChannel PATCH /channels/{id}/settings
ChannelsApi createChannelReaction POST /channels/{channel}/reactions Create channel reaction
ChannelsApi deleteChannelMeasurementLogs DELETE /channels/{channel}/measurement-logs Delete channel measurement logs.
ChannelsApi deleteChannelReaction DELETE /channels/{channel}/reactions/{reaction} Delete channel reaction
ChannelsApi downloadChannelMeasurementLogs GET /channels/{channel}/measurement-logs-download Get measurement logs as a zipped CSV file.
ChannelsApi executeAction PATCH /channels/{id}
ChannelsApi getChannel GET /channels/{id} Get Channel
ChannelsApi getChannelChannelGroups GET /channels/{id}/channel-groups Get Channel Groups that the given channel belongs to
ChannelsApi getChannelDirectLinks GET /channels/{channel}/direct-links Get channel direct links
ChannelsApi getChannelMeasurementLogs GET /channels/{channel}/measurement-logs Get channel measurement logs.
ChannelsApi getChannelNotifications GET /channels/{channel}/notifications
ChannelsApi getChannelReaction GET /channels/{channel}/reactions/{reaction} Get channel reaction
ChannelsApi getChannelReactions GET /channels/{channel}/reactions Get channel reactions
ChannelsApi getChannelScenes GET /channels/{channel}/scenes Get channel scenes
ChannelsApi getChannels GET /channels Get Channels
ChannelsApi updateChannel PUT /channels/{id}
ChannelsApi updateChannelReaction PUT /channels/{channel}/reactions/{reaction} Update channel reaction
ClientAppsApi deleteClientApp DELETE /client-apps/{id} Delete the client app
ClientAppsApi getClientApps GET /client-apps Get Client Apps
ClientAppsApi updateClientApp PUT /client-apps/{id} Update the client app
DevicesApi deleteDevice DELETE /iodevices/{id} Delete the device
DevicesApi executeDeviceAction PATCH /iodevices/{id}
DevicesApi getIoDevice GET /iodevices/{id} Get Device
DevicesApi getIoDeviceNotifications GET /iodevices/{device}/notifications
DevicesApi getIoDevices GET /iodevices Get Devices
DevicesApi updateDevice PUT /iodevices/{id}
DirectLinksApi getDirectLink GET /direct-links/{directLink} Get direct link
DirectLinksApi getDirectLinks GET /direct-links Get Direct Links
EnumsApi getActionsEnum GET /enum/actions
EnumsApi getChannelTypesEnum GET /enum/channel-types
EnumsApi getFunctionsEnum GET /enum/functions
LocationsApi createLocation POST /locations Create a new location
LocationsApi deleteLocation DELETE /locations/{id} Delete the location
LocationsApi getLocation GET /locations/{id} Get location by ID
LocationsApi getLocations GET /locations Get locations
LocationsApi updateLocation PUT /locations/{id} Update the location
NotificationsApi getNotification GET /notifications/{id} Get Notification
NotificationsApi sendNotification PATCH /notifications Send a notification.
NotificationsApi updateNotification PUT /notifications/{notification}
OAuthApi issueAccessToken POST /oauth/v2/token Issues an access token based on authorization_code or refresh_token.
ScenesApi createScene POST /scenes Create a scene
ScenesApi deleteScene DELETE /scenes/{scene} Delete the scene
ScenesApi executeScene PATCH /scenes/{scene}
ScenesApi getScene GET /scenes/{scene} Get Scene
ScenesApi getSceneDirectLinks GET /scenes/{scene}/direct-links Get scene direct links
ScenesApi getSceneScenes GET /scenes/{scene}/scenes Get scene scenes
ScenesApi getScenes GET /scenes Get Scenes
ScenesApi updateScene PUT /scenes/{scene} Update the scene
SchedulesApi getSchedules GET /schedules Get Schedules
ServerApi getServerInfo GET /server-info Get the server info
ServerApi getSuplaServerStatus GET /server-status Get the SUPLA Server status
ServerApi getTokenInfo GET /token-info Returns information about used access token
UserIconsApi createUserIcon POST /user-icons Create a new User Icon
UserIconsApi createUserIconBase64 POST /user-icons.base64 Create a new User Icon sent in Base64 format.
UserIconsApi deleteUserIcon DELETE /user-icons/{id} Delete the User Icon
UserIconsApi getUserIcon GET /user-icons/{id} Get User Icon
UserIconsApi getUserIconImage GET /user-icons/{id}/{imageIndex} Get User Icon image at specified index
UserIconsApi getUserIcons GET /user-icons List User Icons
UsersApi getCurrentUser GET /users/current Get info about user for the token.

Models

Authorization

Personal Access Token

Generate a Personal Access Token for you in the Integrations section on https://cloud.supla.org or your server instance.

OAuth2

  • Flow: authorizationCode
  • Authorization URL: https://cloud.supla.org/oauth/v2/auth if the app is public or https://YOUR_SUPLA_SERVER/oauth/v2/auth otherwise
  • Scopes:
    • accessids_r: Access Identifiers (read)
    • accessids_rw: Access Identifiers (read and modify)
    • account_r: User account and e-mail address (read)
    • account_rw: User account (read and modify)
    • channels_r: Channels (read)
    • channels_rw: Channels (read and modify)
    • channels_ea: Channels (execute actions)
    • channels_files: Download files from API (measurements history, user icons)
    • channelgroups_r: Channel groups (read)
    • channelgroups_rw: Channel groups (read and modify)
    • channelgroups_ea: Channel groups (execute actions)
    • clientapps_r: Client apps (read)
    • clientapps_rw: Client apps (read and modify)
    • directlinks_r: Direct links (read)
    • directlinks_rw: Direct links (read and modify)
    • iodevices_r: IO Devices (read)
    • iodevices_rw: IO Devices (read and modify)
    • locations_r: Locations (read)
    • locations_rw: Locations (read and modify)
    • scenes_r: Scenes (read)
    • scenes_rw: Scenes (read and modify)
    • scenes_ea: Scenes (execute actions)
    • schedules_r: Schedules (read)
    • schedules_rw: Schedules (read and modify)
    • state_webhook: Access to state webhooks
    • mqtt_broker: MQTT Broker settings
    • offline_access: Issue refresh token
  • Example Auth URL: /oauth/v2/auth?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code&scope=account_r%20channels_r&state=example-state

Sources

This PHP package is automatically generated by the OpenAPI Generator project:

  • Targeted Cloud version: 24.01.01-51-gd3ab095f
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages