Download the PHP package rajangdavis/osvc_php without Composer
On this page you can find all versions of the php package rajangdavis/osvc_php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rajangdavis/osvc_php
More information about rajangdavis/osvc_php
Files in rajangdavis/osvc_php
Package osvc_php
Short Description An unofficial PHP wrapper for Oracle Service Cloud (fka RightNow Technologies) REST API
License MIT
Informations about the package osvc_php
OSvCPHP
An (under development) PHP library for using the Oracle Service Cloud REST API influenced by the ConnectPHP API
Installing PHP (for Windows)
Here is a Youtube video with instructions for Windows 10. I would highly recommend installing PHP 7.
If you get SSL Errors (you probably will), follow this link for instructions on resolving SSL things that I know nothing about.
Installation
Install with composer:
$ composer require rajangdavis/osvc_php --dev
Compatibility
This PHP library tested against Oracle Service Cloud May 2017 using PHP 7.2.1.
It is tested against versions 7.2.1 and 5.6.2 on Travis CI.
All of the HTTP methods should work on any version of Oracle Service Cloud since version May 2015; however, there maybe some issues with querying items on any version before May 2016. This is because ROQL queries were not exposed via the REST API until May 2016.
Basic Usage
The features that work to date are as follows:
- HTTP Methods
- For creating objects and POST request with the OSvCPHP\Connect Object
- For reading objects and GET request with the OSvCPHP\Connect Object
- For updating objects, make a PATCH request with the OSvCPHP\Connect Object
- For deleting objects, make a DELETE request with the OSvCPHP\Connect Object
- For looking up options for a given URL, make an OPTIONS request with the OSvCPHP\Connect Object
- Running ROQL queries multiple queries in a set
- Running Reports
- Optional Settings
Here are the spicier (more advanced) features:
- Bulk Delete
- Running multiple ROQL Queries concurrently
- Performing Session Authentication
Authentication
An OSvCPHP\Client class lets the library know which credentials and interface to use for interacting with the Oracle Service Cloud REST API. This is helpful if you need to interact with multiple interfaces or set different headers for different objects.
Optional Settings
In addition to a client to specify which credentials, interface, and CCOM version to use, you will need to create an options object to pass in the client as well as specify any additional parameters that you may wish to use.
Here is an example using the client object created in the previous section:
HTTP Methods
To use various HTTP Methods to return raw response objects, use the "Connect" object
POST
GET
PATCH
DELETE
OPTIONS
Uploading File Attachments
In order to upload a file attachment, add a "files" property to your options object with an array as it's value. In that array, input the file locations of the files that you wish to upload relative to where the script is ran.
Downloading File Attachments
In order to download a file attachment, add a "?download" query parameter to the file attachment URL and send a get request using the OSvCPHP\Connect.get method. The file will be downloaded to the same location that the script is ran.
In order to download multiple attachments for a given object, add a "?download" query parameter to the file attachments URL and send a get request using the OSvCPHP\Connect.get method.
All of the files for the specified object will be downloaded and archived in a .tgz file.
You can extract the file using tar
$ tar -xvzf ./downloadedAttachment.tgz
OSvCPHP\QueryResults example
This is for running one ROQL query. Whatever is allowed by the REST API (limits and sorting) is allowed with this library.
OSvCPHP\QueryResults only has one function: 'query', which takes an OSvCPHP\Client object and string query (example below).
OSvCPHP\QueryResultsSet example
This is for running multiple queries and assigning the results of each query to a key for further manipulation.
OSvCPHP\QueryResultsSet only has one function: 'query_set', which takes an OSvCPHP\Client object and multiple query hashes (example below).
OSvCPHP\AnalyticsReportsResults
You can create a new instance either by the report 'id' or 'lookupName'.
OSvCPHP\AnalyticsReportsResults only has one function: 'run', which takes an OSvCPHP\Client object.
Pass in the 'id', 'lookupName', and 'filters' in the options data object to set the report and any filters.
Bulk Delete
This library makes it easy to use the Bulk Delete feature within the latest versions of the REST API.
You can either use a QueryResults or QueryResultsSet object in order to run bulk delete queries.
Before you can use this feature, make sure that you have the correct permissions set up for your profile.
Here is an example of the how to use the Bulk Delete feature:
Running multiple ROQL Queries concurrently
Instead of running multiple queries with 1 GET request, you can run multiple GET requests and combine the results by adding a "concurrent" property to the options object
Performing Session Authentication
-
Create a custom script with the following code and place in the "Custom Scripts" folder in the File Manager:
- Create a php script similar to the following and it should connect: