Overview
The Analytics Library REST API is provided by the Analytics service. This API enables you to manage the libraries that are used to create SQL++ for Analytics user-defined functions.
Version information
Version : 0.1
Host information
{scheme}://{host}:{port}
The URL scheme, host, and port are as follows.
Component | Description |
---|---|
scheme |
The URL scheme. Use Values: |
host |
The host name or IP address of a node running the Analytics service. Example: |
port |
The Analytics service REST port. Use Values: |
Resources
This section describes the operations available with this REST API.
Delete a Library
DELETE /analytics/library/{scope}/{library}
Parameters
Name | Description | Schema |
---|---|---|
library |
The name of a library. |
String |
scope |
The name of the Analytics scope containing the library. The scope name may contain one or two identifiers, separated by a slash (/). You must URL-encode this parameter to escape any special characters. |
String |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
The operation was successful. |
Object |
404 |
Not found. The library name in the path may be incorrect. |
|
500 |
Internal server error. Incorrect path or port number, incorrect credentials, badly formatted parameters, or missing arguments. |
Example HTTP Request
The example below deletes the mylib
library from the travel-sample.inventory
scope.
curl -X DELETE \
http://localhost:8095/analytics/library/travel-sample%2Finventory/mylib \
-u Administrator:password
The dot separator within the scope name is converted to a slash (/ ), which is then URL-encoded as %2F .
|
Read All Libraries
GET /analytics/library
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
Success. Returns an array of objects, each of which contains information about a single library. |
Libraries array |
404 |
Not found. The path may be missing its trailing slash. |
|
500 |
Internal server error. Incorrect path or port number, incorrect credentials, badly formatted parameters, or missing arguments. |
Create or Update a Library
POST /analytics/library/{scope}/{library}
Description
Creates the specified library and its associated functions. If the specified library exists, the existing library is overwritten.
-
To add a function to a library, update the library with all existing functions, plus the new function.
-
To update a function, update the library with all existing functions, including the updated function definition.
-
To delete a function from a library, update the library with all existing functions, without the deleted function.
-
multipart/form-data
-
application/json
Parameters
Name | Description | Schema |
---|---|---|
library |
The name of a library. |
String |
scope |
The name of the Analytics scope containing the library. The scope name may contain one or two identifiers, separated by a slash (/). You must URL-encode this parameter to escape any special characters. |
String |
Name | Description | Schema |
---|---|---|
data |
The library and all its dependencies, packaged by shiv. |
File (binary) |
type |
The language of the library. Values: |
String |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
The operation was successful. |
Object |
400 |
Bad request. A parameter has an incorrect value. |
|
500 |
Internal server error. Incorrect path or port number, incorrect credentials, badly formatted parameters, or missing arguments. |
Example HTTP Request
The example below creates or updates a library called mylib
in the travel-sample.inventory
scope.
The Python code is stored in a file called lib.pyz
.
curl -X POST \
http://localhost:8095/analytics/library/travel-sample%2Finventory/mylib \
-u Administrator:password \
-d type=python
-d data=lib.pyz
The dot separator within the scope name is converted to a slash (/ ), which is then URL-encoded as %2F .
|
Definitions
This section describes the properties consumed and returned by this REST API.
Libraries
Property | Schema | |
---|---|---|
scope |
The name of the Analytics scope containing the library. The scope name may contain one or two identifiers, separated by a slash (/). Example: |
String |
hash_md5 |
A MD5 hash of the library residing on the server. |
String |
name |
The name of the library. Example: |
String |
Security
The Analytics Library REST API supports HTTP basic authentication. Credentials can be passed via HTTP headers.
Full Admin
To Create or Update a Library or Delete a Library, users must have the Full Admin RBAC role.
Type : http
Analytics Admin
To Read All Libraries, users must have one of the following RBAC roles:
- Full Admin
- Cluster Admin
- Analytics Admin
Type : http
Refer to Roles for more details.