Overview

Enzo Online is an HTTPS service that allows developers to consume online services easily using simple REST requests so developers can focus on building applications quickly without having to deal with complex APIs, multiple SDK versions, development language differences and configuration centralization.

Enzo Online simplifies development by standardizing various online services as a single virtual HTTPS endpoint, regardless of the services' original protocol, authentication mechanism, and specific vernacular. Making HTTPS requests is largely similar no matter which development platform you use, making it very easy to consume online services from any platform, including IoT devices, Mobile phones, serverless services, and even scripting environments such as PowerShell.




Enzo Online accelerates applications developed for Mobile Phones, Web Clients, IoT Devices, Powershell and Serverless components by eliminating the need for SDKs and by standardizing communication protocols.

When calling a specific service through Enzo Online, developers only need to know which URL to call and add query strings, headers and/or a body that represent the parameters for the operation being performed. The URL is constructed by appending the name of the service and the method to the end of the Enzo Online Instance URL assigned to you:

HTTPS://ENZO_URI:ENZO_PORT/bsc/SERVICENAME/OPERATIONNAME

For example the following are valid URI requests calling Enzo Online:

https://enzodemo:19551/bsc/db/executesql
https://enzodemo:19551/bsc/azurebus/createqueue
https://enzodemo:19551/bsc/messaging/sendsmtp

The parameters to include as part of a call is provided in this online documentation. Some of the parameters are required. The service connection information is provided by the _config parameter; this is the name of the configuration setting you create in the Enzo Portal.



Use Cases

Enzo Online is a service that simplifies software development regardless of the application being developed. However Enzo Online provides significant benefit for applications that run on multiple devices, operating systems, limited by HTTP communication, use complex APIs, or do not have formal SDK support.


IoT development can be challenging for many reasons, including the lack of SDKs that provide access to cloud services, messaging, and inter-device communication. IoT development on popular devices (like the Raspberry Pi or Arduino boards including the MXChip) usually involves coding in Python, or native C; this can make it difficult for programmers to build systems. In addition, some devices do not natively support complex protocols.

With Enzo Online, calling services becomes much simple since no service-specific SDK is necessary; making HTTPS calls all that's needed to access the services available in Enzo Online. Sample code is provided in this documentation to help you get started.

For example, you can:

  • Save log data into a SQL Server database from the device
  • Send/Receive a message from a Queue in the cloud
  • Retrieve device secrets stored in the cloud
  • Send an SMS when the IoT device it too hot

Mobile development can be challenging, specifically when creating applications that communicate with online services that do not offer a simple HTTPS communication solution, such as a cloud service bus.

In some cases, mobile development requires serverless programming environments to perform simple tasks, simply because the task cannot easily be performed on the client. Standardizing services through HTTPS communication makes it easier to build mobile applications by reducing the need for serverless development.

For example, you can:

  • Save log data into a SQL Server database from the mobile phone
  • Send/Receive a message from a Queue in the cloud
  • Retrieve application secrets stored in the cloud
  • Send an Email when a critical application error has occurred

Modern web development usually involves creating serverless components that Javascript clients can call, such as AWS Lambda or Azure Functions. However most online services are not accessible using simple HTTPS calls; this forces development teams to build custom server-side services to access complex online services.

Enzo Online accelerates Web development by allowing developers to call the HTTPS services exposed by Enzo Online from serverless components since there is no need to download complex SDKs.

For example, you can:

  • Save log data into a SQL Server database from a serverless script
  • Send/Receive a message from a Queue in the cloud
  • Retrieve application secrets stored in the cloud
  • Send an Email when a critical application error has occurred

Many developers and system administrators need to be able to script deployments and automate infrastructure configuration using PowerShell. However there are virtually no SDKs available for PowerShell outside of infrastructure specific components, making it difficult to integrate PowerShell with more business and user centric services.

Enzo Online enables seamless integration with various Online Services that do not offer an SDK for PowerShell, and can simplify PowerShell development even if an SDK does exist.

For example, you can:

  • Send/Receive a message from a Queue in the cloud
  • Retrieve connection secrets stored in the cloud
  • Send a Text Message when deployment of a resource is complete


Authentication

Authenticating with Enzo is done through a shared key established during the initial configuration of your Enzo Account. A single shared key is used to access all your services. To create multiple shared keys, you must create additional Enzo Accounts.

You send the shared key using the authToken parameter as a Header, a Query String parameter, or a Form Parameter when using POST operations (see Passing Parameters for additional information). The authToken maps to your Enzo Account and should be kept safely in your configuration settings.

authToken: YOUR_AUTH_TOKEN



Configuration Settings

HTTPS requests sent to Enzo Online are identified by their URI; the URI indicates which service is being called, and the last part of the URI indicates which method is being invoked. In order to call the service, Enzo Online also needs to know the service credentials to use. Service Credentials are stored in Enzo Online, and are also called "configuration settings".

Enzo Online determines which configuration setting to use by inspecting three pieces of information: the service name (part of the URI), your Authentication Token (authToken parameter), and the configuration name (_config parameter).

For example, the following REST command calls the DB service's ExecuteSQL command, and loads the CC1 configuration for your account. The CC1 configuration setting holds the database connection string that Enzo Online will use to execute the SQL statement you want to run.

POST ENZO_URI:ENZO_PORT/bsc/db/executesql HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: CC1 sql: SELECT * FROM sys.tables

Configuration settings are stored centrally securely; sensitive information is encrypted. When you delete configuration settings, they are also deleted from the Enzo Online server.



Passing Parameters

All operations called through Enzo Online require passing parameters for the call to succeed. While this documentation uses Headers to outline the various parameters available, all these parameters can be specified as a combination of Query Strings, Headers and/or Body.

Required parameters must be provided with every call to Enzo Online

Parameters sent as a Query String or a Header should be URL Encoded


For example, the following REST command uses Headers to specify the authToken, the _config and the SQL parameters.

POST ENZO_URI:ENZO_PORT/bsc/db/executesql HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: CC1 sql: SELECT+*+FROM+sys.tables

The following example uses the QueryString to pass the authToken, a Header for the configuration name, and the Body of the request to send the SQL parameter. When using the body of a request the Content-Type must be set to application/x-www-form-urlencoded.

POST ENZO_URI:ENZO_PORT/bsc/db/executesql?authToken=YOUR_AUTH_TOKEN HTTP/1.1 Content-Type: application/x-www-form-urlencoded _config: CC1 sql=SELECT * FROM sys.tables


Returned Data

By default all data is returned as a JSON document when calling service methods exposed by Enzo Online. It is also possible to request XML being returned back.

To return XML instead of JSON, simply add .xml at the end of the operation name.


For example, the following REST command returns data as an XML document. Replacing .xml by .json, or simply removing .xml would return data in JSON format.

POST ENZO_URI:ENZO_PORT/bsc/azurestorage/getqueuedetails.xml HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: CC1 name: integrationqueue

The layout of returned data is as follows for JSON and XML documents:

JSON XML
{ "error" : { "errorCode": 0, "errorMsg": null }, "results": { "GetQueueDetails":[{ "name":"name", "value":"integrationqueue", "type":"property" }] } } <?xml version="1.0" encoding="UTF-8"?> <response> <error code="0"></error> <NewDataSet> <GetQueueDetails> <name>name</name> <value>integrationqueue</value> <type>property</type> </GetQueueDetails> </NewDataSet> </response>



Enzo Pipeline

Enzo Pipelines allow you to copy data from one system (source) to another (destination), and forward ongoing changes of the source system to one or more destination systems, using simple configuration options. This solution allows you to extract data from complex source systems, such as SharePoint, and forward the data to a relational database for reporting purposes; you can also implement a Change Data Capture (CDC) capability on top of Twitter or SharePoint for example by forwarding all changes to a service bus for custom processing.

The source system monitoring logic is called a Pipeline. To forward the data captured by a pipeline, you will need to create one or more Listeners A Listener forwards data to a destination system. The logic that reads from the source system and forward data to destination systems is called the Enzo CDC Processing unit. It uses a few internal data stores that the Listeners use to forward data.

Pipeline

To configure a pipeline, you must first configure the corresponding Enzo Service. For example, if you are creating a Pipeline to capture Tweets, you must first create a Twitter configuration in the Enzo Portal.

The schedule allows you to determine how often Enzo should check for changes in the source system. You should keep in mind that some source systems impose restrictions on how often requests can be made. For example, you may not be able to create more than a dozen (more or less) pipelines against Twitter that request changes every 15 minutes. This rate limit is imposed by Twitter. If your pipelines are affected by rate limiting, consider changing the schedule to once every 30 minutes or longer.

You can pause a Pipeline selectively; pausing a pipeline takes effect rapidly and affects all Listeners that are configured on the pipeline.

Due to the nature of this service, it is possible that the same record(s) be pushed multiple times.

INIT and CDC

Enzo Pipelines implement two kinds of data movement options: INIT and CDC. The INIT data movement option is used to copy all available records from the source system to the destination. The CDC data movement option is used to copy changes that are detected going forward.

Not all source systems support the INIT option.

Sample Twitter Pipeline

The Twitter pipeline can only perform CDC captures (not INIT). In addition a Filter is required for this pipeline. The 'twitterconfigdev' configuration setting was created separately in the Twitter configuration section in the portal

Listener

To configure a Listener, you must first create the corresponding Enzo Service, or the Database Connection String that will be used by the Listener. For example, if you are forwarding Twitter CDC changes to a SQL Server database, you should first configure a SQL Server database connection string (under Connection Strings). See Database Connections below for more details about this listener type.

A Listener only forwards CDC changes only after all the INIT records have been forwarded, if requested. You can choose to either send DELETE CDC only, INSERT and UPDATE only, or all changes.

The following destination systems can be used for a Listener:

System Comment
Database Forward source data directly into a database table
Azure Service Bus (Queue) Forward source data as JSON payloads into an Azure Bus Queue
Azure Service Bus (Topic) Forward source data as JSON payloads into an Azure Bus Topic
Azure Storage (Queue) Forward source data as a JSON payload into an Azure queue
Loggly Forward source data to the Loggly service as a JSON payload
Messaging (sms) Triggers an SMS message using the Messaging service
Messaging (smtp) Sends an email address using the Messaging service
Twilio (sms) Sends an SMS message using the Twilio SMS
Twilio (twiml) Triggers a phone call using the Twilio Phone service

You can monitor the status of your Pipeline and Listeners on the portal, and see how many records were forwarded last.

Liteners are designed to retry sending data in case the destination system is temporarily unavailable. If the retry attemps fail, the Listener will continue to attempt to deliver future CDC changes, and the failed records will be stored separately in an Error container. You will have the option to discard the errors, replay them, or replay all CDC changes from the start of the error log. See Error Management below fo further details.

Sample SQL Server Listener

In this sample, the listener points to a SQL Server database; the Listener is able to forward all records (both INIT and CDC) since all options are available from the Pipeline. The destination table name is 'sharepoint.posts'; note that this notation represents a table named 'posts' in a schema called 'sharepoint'. Clickin the View DDL Statement button shows a sample DDL statement that creates the schema and table. The Columns List is empty in this case, meaning that all columns will be copied; however for improved performance it is possible to select which fields to copy to the database by clicking on the Edit button (see further down).

Database Connections

When creating a Listener to forward data to a relational database, you are responsible for creating the database table first. The portal gives you a link to preview the proposed DDL statement that you will need to create the table. You can also choose different column names that the source system

The login provided as part of the connection string needs Select, Insert, Delete and Update rights on the table.

The database server must be accessible from the Internet to be used by Enzo Pipelines. You can use Azure SQL Databases from Microsoft Azure, or RDS SQL Server database instances on AWS for example.

Selecting Fields

Each Listener can select a different set of fields from the Pipeline; clicking on Edit displays a screen that allows you select which fields to forward to the destination system, and if an Alias (Name Override) needs to be used. An Alias allows you to change the name of the destination field. For example, a Title column available from the Pipeline could be aliased to Description in the destination system.

Once the columns have been selected, the list of columns will be listed in the Column List field. Clicking on View DDL Statement will provide the DDL to use to create the destination table.

Certain Source systems have a required field used to synchronize data; this field is always added automatically even if you did not select it specifically. For example in SharePoint the ID field must be forwarded.

Parameters

Certain destination systems require setting parameters in order to successfully forward data or trigger an action. For example, the Twilio SMS service requires the 'message' parameter. You can configure each parameter with one of the following methods:

Value Description Example
Constant Any string value This is an SMS message sent by Enzo Online
Source Column Any column from the source system, prepended by the @ sign @ID
Function An Enzo function; functions start with the letter #

  • #now() - Current timestamp (server time)
  • #utcnow() - Current timestamp (UTC)
  • #rndguid() - Random GUID value
  • #rndint(a,b) - Random integer value between [a,b[
  • #rnddouble(a,b) - Random double value between [a,b[
  • #pick(a,b...) - Randomly selects a value from the comma-separater list provided
#rndguid()
You can combine constants, columns and functions. Functions are applied last. For example, you can specify the 'message' parameter of the Twilio SMS call as: Record ID @ID was modified in the source system

CDC Replay

If the pipeline is enabled for CDC capture, you have the ability to replay the CDC log from a specific date/time starting point, until the end of the CDC log. This CDC Replay capability allows you to re-synchronize a destination data source if there is a discrepency; this feature can be useful if you restored a destination database server that could be a few hours behind. When selecting the option to replay you need to specify a date/time in UTC from which to replay the CDC log.

Error Management

Errors are stored in an Error Log after the CDC operation has failed too many times, as specified by the Max Retries option of the Listener. Once errors are logged, you will have the option to discard the errors, replay them, or replay all CDC changes from the start of the error log as shown in the screenshot below. In addition, the last error message is displayed.



Azure IoT Hub

The Azure IoT Hub Enzo service allows you to manage Azure IoT devices, send messages on behalf of an IoT device, receive messages sent from the IoT Hub, and simulate a field of IoT devices for functionality testing and modeling purposes.

Due to CPU consumption, contact us to enable access to the SendTestData method.

Commands

Name Description
SendMessage POST Sends a message on behalf of an IoT device. details 


/bsc/azureiothub/sendmessage

HTTP Headers

Name Description
id R The id of the IoT device
data R The data to send (such as a JSON payload)
_config R The name of the configuration to use
messageId The unique message id (defaults to a random GUID if not provided)
ack The acknowledgment of the device (full, success, failure, none); defaults to none
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateDevice POST Creates a new IoT device in the IoT Hub details 


/bsc/azureiothub/createdevice

HTTP Headers

Name Description
_config R The name of the configuration to use
id The name/id of the device to create; it none is provided a random name will be assigned
primaryKey The primary key of the device; it none is provided a random key will be assigned
secondaryKey The secondary key of the device; it none is provided a random key will be assigned
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "CreateDevice": [ {
            "id": "devicename",
            "primaryKey": "primaryKey",
            "secondaryKey": "secondaryKey",
            "connectionString": "connectionString for this device",
            "connectionState": "connection state for this device"
        } ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateDevices POST Creates a range of devices in the IoT Hub details 


/bsc/azureiothub/createdevices

HTTP Headers

Name Description
range R A numeric range separated by a dash; ex: 50-99
id R The id of the device to create with a ? for numeric replacement; ex: device? or us-?-sensor
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "CreateDevices": [ {
            "id": "devicename1",
            "primaryKey": "primaryKey",
            "secondaryKey": "secondaryKey",
            "connectionString": "connectionString for this device",
            "connectionState": "connection state for this device"
            }, {
            "id": "devicename2",
            "primaryKey": "primaryKey",
            "secondaryKey": "secondaryKey",
            "connectionString": "connectionString for this device",
            "connectionState": "connection state for this device"
        } ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteDevice POST Deletes an existing device from the IoT Hub details 


/bsc/azureiothub/deletedevice

HTTP Headers

Name Description
id R The name/id of the device
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteDevices POST Deletes a range of devices from the IoT Hub details 


/bsc/azureiothub/deletedevice

HTTP Headers

Name Description
range R A numeric range separated by a dash; ex: 50-99
id R The name/id of the device with a ? for numeric replacement; ex: device? or us-?-sensor
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
FlushDeviceCache POST Flushes the cached device collection that is created as devices are loaded; the cache device collection stored the list of device connection strings for improved performance. If connection strings change, it is recommended to flush the cache. details 


/bsc/azureiothub/flushdevicecache

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListDevices GET Returns the list of IoT devices registered in the IoT Hub details 


/bsc/azureiothub/listdevices

HTTP Headers

Name Description
_config R The name of the configuration to use
id The name/id of the device starting with the string provided
count Count of devices requested; 100 by default
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "ListDevices": [{
            "id": "deviceid",
            "primaryKey": "primarykey",
            "secondaryKey": "secondaryKey",
            "connectionString": "device connection string",
            "connectionState": "connection state of this device",
            "lastActivityTime": "2017-12-01:01:00:00.001Z",
            "lastConnectionTime": "2017-12-01:01:00:00.001Z",
            "lastStateUpdateTime": "2017-12-01:01:00:00.001Z",
            "messageCount": 100,
            "state": "connected",
            "suspensionReason": (null),
            "count": 100
        }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
SendData POST Sends data on behalf of a device details 


/bsc/azureiothub/senddata

HTTP Headers

Name Description
id R The id of the device to impersonate
data R The data to send as a string (JSON payload for example)
_config R The name of the configuration to use
messageId The message identifier
properties Comma-separated list of properties for this message (ex: place=home,priority=high)
correlationId An optional correlation identifier
to An optional 'to' property of the message
userId An optional user id for the message
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "SendData": [{
            "id": "deviceid",
            "dateTime": "2017-12-01:01:00:00.001Z",
            "messageId": "abcde-fgh...",
            "data": "payload sent",
            "properties": "state=florida",
            "durationms": 455
        }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
SendTestData POST Sends semi-random test data on behalf of a range of devices
Contact support to enable this operation
details 


/bsc/azureiothub/sendtestdata

HTTP Headers

Name Description
msgcount R Minimum number of messages to send from devices
delayms R Delay in millisecond between data send operations
id R Comma-separated list of device ids to send data from
data R The template data to send as a string (supports functions: #deviceid(), #utcnow(), #now(), #rndguid(), #rndint(min,max), #rnddouble(min,max), #pick(a,b,c,...)); ex: { "deviceid": "#deviceid()", "clienttime": "#utcnow()", "devicetype": "#pick(lamp,fridge,door)", "value": #rndint(0,100) }
_config R The name of the configuration to use
properties Comma-separated list of properties for this message (ex: place=home,priority=high)
correlationId An optional correlation identifier
to An optional 'to' property of the message
userId An optional user id for the message
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "SendTestData": [{
            "id": "deviceid1",
            "dateTime": "2017-12-01:01:00:00.001Z",
            "messageId": "abcde-fgh...",
            "data": "payload sent",
            "properties": "state=florida",
            "durationms": 455
            }, {
            "id": "deviceid2",
            "dateTime": "2017-12-01:01:00:00.001Z",
            "messageId": "abcde-fgh...",
            "data": "payload sent",
            "properties": "state=florida",
            "durationms": 450
        }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
UpdateDevice POST Updates the primary keys of a device in the IoT Hub details 


/bsc/azureiothub/updatedevice

HTTP Headers

Name Description
id R The name/id of the device to update
_config R The name of the configuration to use
primaryKey The primary key of the device; it none is provided a random key will be assigned
secondaryKey The secondary key of the device; it none is provided a random key will be assigned
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "UpdateDevice": [ {
            "id": "devicename",
            "primaryKey": "primaryKey",
            "secondaryKey": "secondaryKey",
            "connectionString": "connectionString for this device",
            "connectionState": "connection state for this device"
        } ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to send a payload to the IoT Hub using Enzo through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/azureiothub/senddata"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("id", "device1"); wr.Headers.Add("data", "{ ""sensor"": ""temp"", ""value"": 40.3 }"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/azureiothub/senddata" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'name':'mysecret', 'authToken': enzoguid, 'id': 'device1', 'data': '{ "sensor": "temp", "value": 40.3 }' '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/azureiothub/senddata HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname id: device1 data: {"sensor":"temp","value":40.3} name: mysecret

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/azureiothub/senddata"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("name", "mysecret"); client.set_header("id", "device1"); client.set_header("data", "{""sensor"":""temp"",""value"":40.3}"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Azure Key Vault

The Azure Key Vault service allows you to save and retrieve secrets from the Azure Key Vault service. Using this service requires a Microsoft Azure account, and the Azure Key Vault service created in Azure. Additional security configuration is needed before you can access the Key Vault from the Enzo Service.

Please contact info@enzounified.com if you need assistance with configuring this service.

Commands

Name Description
DeleteSecret POST Deletes a secret in the specified Key Vault details 


/bsc/azurekeyvault/deletesecret

HTTP Headers

Name Description
name R The name of the secret to delete
_config R The name of the configuration to use
keyvault The Azure Key Vault to use; overrides the default value provided in the configuration settings.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSecret GET Retrieves a secret from the Key Vault details 


/bsc/azurekeyvault/getsecret

HTTP Headers

Name Description
name R The name of the secret to return
_config R The name of the configuration to use
keyvault The Azure Key Vault to use; overrides the default value provided in the configuration settings.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSecret": [ 
            {
                "name":"CodeCampSecret",
                "value":"12345",
                "tags":"country=us;state=fl",
                "contentType":"numbers",
                "identifier":"https://....vault.azure.net:443/secrets/...",
                "created":"3/11/2017 9:23:06 PM",
                "updated":"3/11/2017 9:24:06 PM",
                "notBefore":null,
                "enabled":"True"}
            }
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSecrets GET Retrieves the list of secrets available in the Key Vault details 


/bsc/azurekeyvault/getsecrets

HTTP Headers

Name Description
_config R The name of the configuration to use
keyvault The Azure Key Vault to use; overrides the default value provided in the configuration settings.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSecrets": [ 
            {
                "name":"CodeCampSecret",
                "tags":"country=us;state=fl",
                "contentType":"numbers",
                "identifier":"https://....vault.azure.net:443/secrets/...",
                "created":"3/11/2017 9:23:06 PM",
                "updated":"3/11/2017 9:24:06 PM",
                "notBefore":null,
                "enabled":"True"}
            }
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SetSecret POST Creates or updates a secret in the Key Vault details 


/bsc/azurekeyvault/setsecret

HTTP Headers

Name Description
name R The name of the secret to create or update
value R The value to set or update
contentType The optional content type of the secret
tags Optional semi-column separated list of key=value pairs (ex: country=usa;state=fl)
_config R The name of the configuration to use
keyvault The Azure Key Vault to use; overrides the default value provided in the configuration settings.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SetSecretAttributes POST Updates the properties of an existing secret in the Key Vault details 


/bsc/azurekeyvault/setsecretattributes

HTTP Headers

Name Description
name R The name of the secret to update
contentType The optional content type of the secret
tags Optional semi-column separated list of key=value pairs (ex: country=usa;state=fl)
_config R The name of the configuration to use
keyvault The Azure Key Vault to use; overrides the default value provided in the configuration settings.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/azurekeyvault/getsecret"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("name", "mysecret"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/azurekeyvault/getsecret" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'name':'mysecret', 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/azurekeyvault/getsecret HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname name: mysecret

This example shows you how to get a secret, called 'mysecret', from the Azure Key Vault using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/azurekeyvault/getsecret"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("name", "mysecret"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Azure Service Bus

The Azure Service Bus service allows you to manage Azure Bus Queues, Topics and Subscriptions, and to send/receive messages through HTTP commands.

Commands

Name Description
AbandonQueueMessage POST Abandons a message in a lock state. details 


/bsc/azurebus/abandonqueuemessage

HTTP Headers

Name Description
name R The name of the queue
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
AbandonSubMessage POST Abandons a message in a lock state in a subscription. details 


/bsc/azurebus/abandonsubmessage

HTTP Headers

Name Description
topicName R The name of the topic
subname R The name of the subscription
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
CompleteQueueMessage POST Completes a message in a lock state. details 


/bsc/azurebus/completequeuemessage

HTTP Headers

Name Description
name R The name of the queue
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
CompleteSubMessage POST Completes a message in a lock state in a subscription. details 


/bsc/azurebus/completesubmessage

HTTP Headers

Name Description
topicName R The name of the topic
subname R The name of the subscription
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
CreateQueue POST Creates a new Service Bus queue details 


/bsc/azurebus/createqueue

HTTP Headers

Name Description
name R The name of the queue to create
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
ttlLock Time to live (sec) for a message lock
enableDeadLetter True to enable dead letter queues
enableExpress True to enable express queues
enablePartitioning True to enable partitioning of queues
isAnonymous True to enable anonymous connections
maxDeliveryCount Maximum number of delivery attempts
forwardDLTo The name of the dead-letter queue
forwardTo Name of a queue where messages will be forwarded to
maxSize Maximum size in MB (1024, 2048, 3072, 4096, 5120)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
CreateSubscription POST Creates a subscription on a topic. details 


/bsc/azurebus/createsubscription

HTTP Headers

Name Description
topicName R The name of the topic
subscriptionName R The name of the subscription
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
ttlLock Time to live (sec) for a message lock
dealLetterOnEvalErrors True to enable dead letter queue on evaluation errors
dealLetterOnExpire True to enable dead letter queue on message expiration
maxDeliveryCount Maximum number of delivery attempts
forwardDLTo The name of the dead-letter queue
forwardTo Name of a queue where messages will be forwarded to
sqlFilter An SQL-like filter used to determine which messages are received by this subcription
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
CreateTopic POST Creates a new Service Bus Topic details 


/bsc/azurebus/createtopic

HTTP Headers

Name Description
name R The name of the topic to create
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
enableExpress True to enable express queues
enablePartitioning True to enable partitioning of queues
isAnonymous True to enable anonymous connections
enableFiltering True to enable filtering prior to publishing
maxSize Maximum size in MB (1024, 2048, 3072, 4096, 5120)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
DeleteQueue POST Deletes a Service Bus Queue details 


/bsc/azurebus/deletequeue

HTTP Headers

Name Description
name R The name of the queue to delete
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
DeleteSubscription POST Deletes a Service Bus Subscription details 


/bsc/azurebus/deletesubscription

HTTP Headers

Name Description
topicName R The name of the topic where the subscription belongs
subscriptionName R The name of the subscription to delete
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
DeleteTopic POST Deletes a Service Bus Topic details 


/bsc/azurebus/deletetopic

HTTP Headers

Name Description
name R The name of the topic to delete
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
ListQueue GET Lists available queues details 


/bsc/azurebus/listqueue

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "ListQueue": [{
                            "name": " ",
                            "status": " ",
                            "sizeInBytes": " ",
                            "queueLength": " ",
                            "lastAccessedTime": " ",
                            "createdAt": " ",
                            "msgTTL": " ",
                            "isDeadLetterEnabled": " ",
                            "enableExpress": " ",
                            "enablePartitioning": " ",
                            "forwardDLMessagesTo": " ",
                            "forwardTo": " ",
                            "isAnonymousAccessible": " ",
                            "isReadOnly": " ",
                            "lockDuration": " ",
                            "maxDeliveryCount": " ",
                            "maxSizeInMegabytes": " "}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
ListSubscription GET Lists subscriptions that belong to a Topic details 


/bsc/azurebus/listsubscription

HTTP Headers

Name Description
topicName R The name of the topic
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "ListSubscription": [{
                            "topicName": " ",
                            "subscriptionName": " ",
                            "messageCount": ,
                            "status": " ",
                            "lastAccessed": " ",
                            "createdAt": " ",
                            "ttlMsg": ,
                            "readOnly": ,
                            "maxDeliveryCount": ,
                            "dealLetterOnEvalErrors": ,
                            "dealLetterOnExpire": ,
                            "forwardDLTo": " ",
                            "forwardTo": " ",
                            "ttlLock": ,
                            "filters": " "}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
ListTopic GET Lists available topics details 


/bsc/azurebus/listtopic

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "ListTopic": [{
                            "name": " ",
                            "status": " ",
                            "sizeInBytes": " ",
                            "lastAccessedTime": " ",
                            "createdAt": " ",
                            "msgTTL": " ",
                            "enableExpress": " ",
                            "enablePartitioning": " ",
                            "isAnonymousAccessible": " ",
                            "isReadOnly": " ",
                            "maxSizeInMegabytes": " "}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
PeekLockFromQueue GET Receives a message from a queue and leaves the message in the queue by releasing the lock, or removes it from the queue by completing the message. details 


/bsc/azurebus/peeklockfromqueue

HTTP Headers

Name Description
name R The name of the queue
_config R The name of the configuration to use
complete When true, completes and removes the message from the queue; when false, leaves the lock on the message (default)
count Approximate number of messages to return
timeoutSec The timeout for the wait operation; specify 0 for infinite (default: 1 second)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "PeekLockFromQueue": [{
                            "name": " ",
                            "body": " ",
                            "bodyAsBytes": ,
                            "messageId": " ",
                            "correlationId": " ",
                            "sessionId": " ",
                            "replyTo": " ",
                            "label": " ",
                            "contentType": " ",
                            "properties": " ",
                            "sequenceNumber": ,
                            "to": " ",
                            "enqueuedTimeUtc": " ",
                            "ttl": ,
                            "deliveryCount": " ",
                            "expiresUtc": " ",
                            "lockedUntilUtc": " ",
                            "lockToken": " ",
                            "partitionKey": " ",
                            "replyToSessionId": " ",
                            "size": ,
                            "viaPartitionKey": " "}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
PeekLockFromSubscription GET Receives a message from a queue and leaves the message in the queue by releasing the lock, or removes it from the queue by completing the message. details 


/bsc/azurebus/peeklockfromsubscription

HTTP Headers

Name Description
topicname R The name of the topic
subname R The name of the subscription
_config R The name of the configuration to use
complete When true, completes and removes the message from the queue; when false, leaves the lock on the message (default)
count Approximate number of messages to return
timeoutSec The timeout for the wait operation; specify 0 for infinite (default: 1 second)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "PeekLockFromSubscription": [{
                            "topicname": " ",
                            "subname": " ",
                            "body": " ",
                            "bodyAsBytes": ,
                            "messageId": " ",
                            "correlationId": " ",
                            "sessionId": " ",
                            "replyTo": " ",
                            "label": " ",
                            "contentType": " ",
                            "properties": " ",
                            "sequenceNumber": ,
                            "to": " ",
                            "enqueuedTimeUtc": " ",
                            "ttl": ,
                            "deliveryCount": " ",
                            "expiresUtc": " ",
                            "lockedUntilUtc": " ",
                            "lockToken": " ",
                            "partitionKey": " ",
                            "replyToSessionId": " ",
                            "size": ,
                            "viaPartitionKey": " "}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
RenewLockQueueMessage POST Extends the lock of a message. details 


/bsc/azurebus/renewlockqueuemessage

HTTP Headers

Name Description
name R The name of the queue
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
RenewLockSubMessage POST Extends the lock of a message in a subscription. details 


/bsc/azurebus/renewlocksubmessage

HTTP Headers

Name Description
topicName R The name of the topic
subname R The name of the subscription
lockId R The lock id of the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
SendMessageAsBytesToQueue POST Send a message in a queue as a UTF-8 encoded byte array details 


/bsc/azurebus/sendmessageasbytestoqueue

HTTP Headers

Name Description
name R The name of the queue where the message will be sent
body R The message content as a byte array
_config R The name of the configuration to use
messageId A message identifier used to detect duplicate messages (cannot be longer than 128 characters)
correlationId A correlation identifier
sessionId A session identifier
replyTo The address of the queue to reply to
label An optional application label
contentType The content type (ex: application/pdf)
properties A comma-separated list of key value pairs (ex: state=FL,flag=1 )
partitionKey PartitionKey used for transactional messages in non session-aware queues
msgTTL The message time-to-live in seconds
to The send to address
viaPartitionKey The PartitionKey value when a transaction is to be used to send messages via a transfer queue
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
SendMessageAsBytesToTopic POST Send a message in a queue as a UTF-8 encoded byte array details 


/bsc/azurebus/sendmessageasbytestotopic

HTTP Headers

Name Description
name R The name of the queue where the message will be sent
body R The message content as a byte array
_config R The name of the configuration to use
messageId A message identifier used to detect duplicate messages (cannot be longer than 128 characters)
correlationId A correlation identifier
sessionId A session identifier
replyTo The address of the queue to reply to
label An optional application label
contentType The content type (ex: application/pdf)
properties A comma-separated list of key value pairs (ex: state=FL,flag=1 )
partitionKey PartitionKey used for transactional messages in non session-aware queues
msgTTL The message time-to-live in seconds
to The send to address
viaPartitionKey The PartitionKey value when a transaction is to be used to send messages via a transfer queue
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
SendMessageToQueue POST Send a message in a queue details 


/bsc/azurebus/sendmessagetoqueue

HTTP Headers

Name Description
name R The name of the queue where the message will be sent
body R The message content
_config R The name of the configuration to use
messageId A message identifier used to detect duplicate messages
correlationId A correlation identifier
sessionId A session identifier
replyTo The address of the queue to reply to
label An optional application label
contentType The content type (ex: text/xml)
properties A comma-separated list of key value pairs (ex: state=FL,flag=1 )
partitionKey PartitionKey used for transactional messages in non session-aware queues
msgTTL The message time-to-live in seconds
to The send to address
viaPartitionKey The PartitionKey value when a transaction is to be used to send messages via a transfer queue
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
SendMessageToTopic POST Send a message in a topic details 


/bsc/azurebus/sendmessagetotopic

HTTP Headers

Name Description
name R The name of the queue where the message will be sent
body R The message content
_config R The name of the configuration to use
messageId A message identifier used to detect duplicate messages
correlationId A correlation identifier
sessionId A session identifier
replyTo The address of the queue to reply to
label An optional application label
contentType The content type (ex: text/xml)
properties A comma-separated list of key value pairs (ex: state=FL,flag=1 )
partitionKey PartitionKey used for transactional messages in non session-aware queues
msgTTL The message time-to-live in seconds
to The send to address
viaPartitionKey The PartitionKey value when a transaction is to be used to send messages via a transfer queue
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
UpdateQueue POST Updates a Service Bus queue details 


/bsc/azurebus/updatequeue

HTTP Headers

Name Description
name R The name of the queue to update
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
ttlLock Time to live (sec) for a message lock
status The status of the queue (enable, disable, sendonly, receiveonly)
enableDeadLetter True to enable dead letter queues
enableExpress True to enable express queues
enablePartitioning True to enable partitioning of queues
isAnonymous True to enable anonymous connections
maxDeliveryCount Maximum number of delivery attempts
forwardDLTo The name of the dead-letter queue
forwardTo Name of a queue where messages will be forwarded to
maxSize Maximum size in MB (1024, 2048, 3072, 4096, 5120)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
UpdateSubscription POST Updates a subscription on a topic. details 


/bsc/azurebus/updatesubscription

HTTP Headers

Name Description
topicName R The name of the topic
subscriptionName R The name of the subscription
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
ttlLock Time to live (sec) for a message lock
status The status of the queue (enable, disable, sendonly)
dealLetterOnEvalErrors True to enable dead letter queue on evaluation errors
dealLetterOnExpire True to enable dead letter queue on message expiration
maxDeliveryCount Maximum number of delivery attempts
forwardDLTo The name of the dead-letter queue
forwardTo Name of a queue where messages will be forwarded to
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
UpdateTopic POST Updates a Service Bus Topic details 


/bsc/azurebus/updatetopic

HTTP Headers

Name Description
name R The name of the topic to update
_config R The name of the configuration to use
ttlMsg Time to live (sec) for messages in a queue
status The status of the queue (enable, disable, receiveonly)
enableExpress True to enable express queues
enablePartitioning True to enable partitioning of queues
isAnonymous True to enable anonymous connections
enableFiltering True to enable filtering prior to publishing
maxSize Maximum size in MB (1024, 2048, 3072, 4096, 5120)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

    {
        "results": null,
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }

Sample Code

This example shows you how to create an Azure Service Bus Queue through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/azurebus/createqueue"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("name", "queuename"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to create an Azure Service Bus Queue using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/azurebus/createqueue" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'name':'queuename', 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to create an Azure Service Bus Queue using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/azurebus/createqueue HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname name: queuename

This example shows you how to create an Azure Service Bus Queue using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/azurebus/createqueue"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("name", "queuename"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Azure Storage

The Azure Storage service allows you to create/read/update/delete Azure Blobs, Azure Tables and Azure Queues. Using this service requires a Microsoft Azure account, and a Storage Account created under your Azure account.

Commands

Name Description
Blob & Blob Container Operations
BlobContainerExists GET Returns true if the container already exists. details 


/bsc/azurestorage/blobcontainerexists

HTTP Headers

Name Description
container R The name of the container
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "BlobContainerExists": [{
            "exists": True
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateBlobContainer POST Creates a Blob Container details 


/bsc/azurestorage/createblobcontainer

HTTP Headers

Name Description
container R The name of the container to create
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteBlob POST Deletes an Azure Blob from a Container details 


/bsc/azurestorage/deleteblob

HTTP Headers

Name Description
_config R The name of the configuration to use
container The name of the Azure Container where the Blob resides. R
name The name of the Azure Blob. R
leaseId Optional LeaseId if one was previously obtained.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteBlobContainer POST Deletes a Blob Container details 


/bsc/azurestorage/deleteblobcontainer

HTTP Headers

Name Description
container R The name of the Blob Container to delete
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetBlob GET Retrieves the content of a Blob details 


/bsc/azurestorage/getblob

HTTP Headers

Name Description
container R The name of the Azure Container
name R The name of the blob
_config R The name of the configuration to use
leaseId The LeaseId, if one was previously obtained
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetBlob": [{
            "type": "PageBlob",
            "contentType": "text/plain",
            "lastModified": "2014-12-18T04:05:58",
            "leaseStatus": "unlocked",
            "length": 584602,
            "name": "myblobname.txt",
            "snapshot": (null),
            "content": "JVBERi0...RU9GDQ=="
        }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
GetBlobContainerDetails GET Retrieves the properties and metadata on a blob container details 


/bsc/azurestorage/getblobcontainerdetails

HTTP Headers

Name Description
container R The name of the Azure Container
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetBlobContainerDetails": [{
                "name": "Test1",
                "type": "metadata",
                "value": "test2"
            },{
                "name": "LastModified",
                "type": "property",
                "value": "12/18/2014 4:05:57 AM"
            },{
                "name": "Permission",
                "type": "permission",
                "value": ""
            }
            ]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
GetBlobContainers GET Retrieves the list of containers in a Storage Account details 


/bsc/azurestorage/getblobcontainers

HTTP Headers

Name Description
nameStartsWith The name of the Azure Container
_config R The name of the configuration to use
top Maximum number of containers to return; by default all containers are returned
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetBlobContainers": [{
                "name": "$root"
            },{
                "name": "documents"
            },{
                "name": "applog"
            }
            ]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
GetBlobDetails GET Retrieves the properties and metadata of a blob details 


/bsc/azurestorage/getblobdetails

HTTP Headers

Name Description
container R The name of the Azure Container
name R The name of the Azure Blob
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetBlobDetails": [{
                "name": "Test1",
                "type": "metadata",
                "value": "test2"
            },{
                "name": "LastModified",
                "type": "property",
                "value": "12/18/2014 4:05:57 AM"
            },{
                "name": "Length",
                "type": "property",
                "value": 584602
            },{
                "name": "Snapshot",
                "type": "property",
                "value": (null)
            },{
                "name": "ContentType",
                "type": "property",
                "value": "text/plain"
            },{
                "name": "Type",
                "type": "property",
                "value": "PageBlob"
            },{
                "name": "LeaseStatus",
                "type": "property",
                "value": "unlocked"
            }
            ]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
GetBlobs GET Retrieves the list of blobs stored in a storage container details 


/bsc/azurestorage/getblobs

HTTP Headers

Name Description
container R The name of the Azure Container
_config R The name of the configuration to use
startsWith The name of the Azure Blob starting with a specific string
top Maximum number of blobs to return; by default all blobs are returned
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetBlobs": [{
                "name": "document1.txt"
            }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
RemoveBlobMetadata POST Removes metadata of the blob details 


/bsc/azurestorage/removeblobmetadata

HTTP Headers

Name Description
container R The name of the Azure Container
name R The name of the blob
key R The name of the metadata entry to remove
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
SaveBlob POST Creates or updates a blob in a blob container details 


/bsc/azurestorage/saveblob

HTTP Headers

Name Description
container R The name of the Azure Container
name R The name of the blob
type R The type of blob to create (page/block)
content R The blob content as a byte array
_config R The name of the configuration to use
mime The Mime type of the blob
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SetBlobContainerMetadata POST Sets metadata on a blob container details 


/bsc/azurestorage/setblobcontainermetadata

HTTP Headers

Name Description
container R The name of the Azure Container
key R The name of the metadata entry
value R The value of the metadata entry R
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SetBlobMetadata POST Sets metadata on a blob details 


/bsc/azurestorage/setblobmetadata

HTTP Headers

Name Description
container R The name of the Azure Container
name R The name of the blob
key R The name of the metadata entry
value R The value of the metadata entry R
_config R The name of the configuration to use
leaseId The LeaseId of the blob, if one exists
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Table & Entity Operations
DeleteEntity POST Delete an entity in an Azure Table details 


/bsc/azurestorage/deleteentity

HTTP Headers

Name Description
tableName R The name of the Azure Table
partitionKey R The PartitionKey of the entity
rowKey R The RowKey of the entity
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetEntities GET Retrieves all entities from an Azure Table details 


/bsc/azurestorage/getentities

HTTP Headers

Name Description
tableName R The name of the Azure Table
_config R The name of the configuration to use
columns Comma-separated list of columns to retrieve
filter A SQL-like filter that limits the number of records being returned
continuationToken The continuation token provided by Enzo from a previous call to GetEntities, and found in the _continuationToken node of the response object.
paging Maximum number of entities to return; by default all entities are returned. When paging is provided, a non-null value in the _continuationToken node of the response object means that additional entities are available.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetEntities": [{
            "PartitionKey": "PK001",
            "RowKey": "RK001",
            "Country": "USA",
            "State": "FL"
        }]
    },
    "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
}
                        
SeekEntity GET Retrieves a single entity given its PartitionKey and RowKey details 


/bsc/azurestorage/seekentity

HTTP Headers

Name Description
tableName R The name of the Azure Table
partitionKey R The PartitionKey of the entity
rowKey R The RowKey of the entity
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "SeekEntity": [{
            "PartitionKey": "PK001",
            "RowKey": "RK001",
            "Country": "USA",
            "State": "FL"
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
SaveEntity POST Saves an Entity in an Azure Table details 


/bsc/azurestorage/saveentity

HTTP Headers

Name Description
tableName R The name of the Azure Table
data R An XML or JSON string that contains the properties of the entity. Must contain the PartitionKey and RowKey elements. You can specify the data type of each element using the Type attribute (valid types: bool,byte,byte[],datetime,numeric,int,long,string); by default an element is stored as a string. You can also send multiple entities at once.
When using a JSON document, you can send a JSON object or a JSON Array, allowing you to save multiple entities in a single call.
Supports functions: #utcnow(), #now(), #rndguid(), #rndint(min,max), #rnddouble(min,max), #pick(a,b,c,...). Ex: PK001#rndguid()#pick(lamp,fridge,door)#rndint(0,100)
_config R The name of the configuration to use
mode Specifies how the entity will be saved: upsert, insert or update. By default, an upsert operation is performed.
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
CreateTable POST Creates an Azure Table details 


/bsc/azurestorage/createtable

HTTP Headers

Name Description
tablename R The name of the Azure Table
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteTable POST Deletes an Azure Table details 


/bsc/azurestorage/deletetable

HTTP Headers

Name Description
name R The name of the Azure Table
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetTables GET Retrieves the list of Azure Tables details 


/bsc/azurestorage/gettables

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetTables": [{
            "name": "table1"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
TableExists GET Returns true if an Azure Table already exists details 


/bsc/azurestorage/tableexists

HTTP Headers

Name Description
name R The name of an Azure Table
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "TableExists": [{
            "exists": true
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
Queue & Message Operations
ClearQueue POST Removes all messages from an Azure Queue details 


/bsc/azurestorage/clearqueue

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateQueue POST Creates a new Azure Queue details 


/bsc/azurestorage/createqueue

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteMessage POST Deletes a message from an Azure Queue details 


/bsc/azurestorage/deletemessage

HTTP Headers

Name Description
name R The name of the Azure Queue
id R The MessageId to delete
receipt R The ReceiptId of the get operation that fetched the message
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteQueue POST Deletes an Azure Queue details 


/bsc/azurestorage/deletequeue

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetMessageCountQueues GET Retrieves the approximate number of messages in a queue details 


/bsc/azurestorage/getmessagecountqueues

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetMessageCountQueues": [{
                "count": 10
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
GetMessages GET Retrieves the approximate number of messages in a queue details 


/bsc/azurestorage/getmessages

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
count Number of messages to read from the queue (default: 0, max: 32)
visibility Specifies the visibility timeout of a message (default: 0)
Remove When 1, remove the message(s) from the queue immediately (default: 0)
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetMessages": [{
                "content": "This is a string message content",
                "contentBytes": "FEGPB...A=",
                "dequeueCount": 1,
                "id": "efc0-2fea...",
                "receipt": "aef5-03ba...",
                "@insertionDate": "2017-10-01T21:00:00.000Z",
                "@nextVisibleOn": "2017-10-01T22:00:00.000Z",
                "@expirationDate": "2017-17-01T21:00:00.000Z"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
GetQueueDetails GET Gets metadata and properties from an Azure Queue details 


/bsc/azurestorage/getqueuedetails

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetQueueDetails": [{
                "name": "name",
                "value": "myqueue",
                "type": "property"
            },{
                "name": "approximateMsgCount",
                "value": "1",
                "type": "property"
            },{
                "name": "country",
                "value": "UK",
                "type": "metadata"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
ListQueues GET Retrieves the list of all available Azure Queues details 


/bsc/azurestorage/listqueues

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "ListQueues": [{
                "name": "myqueue"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
PeekMessage GET Peeks at the next message in an Azure Queue details 


/bsc/azurestorage/peekmessage

HTTP Headers

Name Description
name R The name of the Azure Queue
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "PeekMessage": [{
                "content": "this is a test message",
                "contentBytes": "dGhpcyBpcyBhIHRlc3QgbWVzc2FnZQ==",
                "dequeueCount": 0,
                "id": "e4d45003-0ed4-40d2-b865-d3225e3deddc",
                "insertionDate": "2017-11-06T20:23:58",
                "expirationDate": "2017-11-06T21:23:58",
                "nextVisibleOn": "(null)
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
                        
RemoveQueueMetadata POST Peeks at the next message in an Azure Queue details 


/bsc/azurestorage/removequeuemetadata

HTTP Headers

Name Description
name R The name of the Azure Queue
key R The name of the metadata entry
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SendMessage POST Inserts a message in an Azure Queue details 


/bsc/azurestorage/sendmessage

HTTP Headers

Name Description
name R The name of the Azure Queue
content R The message to send (string)
Supports functions: #utcnow(), #now(), #rndguid(), #rndint(min,max), #rnddouble(min,max), #pick(a,b,c,...). Ex: MSGID:#rndguid()\r\nSTATE:#pick(FL,CA,NY,IL)\r\nVALUE:#rndint(0,100)
_config R The name of the configuration to use
ttl R The message time to live in seconds (default: 0)
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SetQueueMetadata POST Saves or updates metadata on an Azure Queue details 


/bsc/azurestorage/setqueuemetadata

HTTP Headers

Name Description
name R The name of the Azure Queue
key R The key of the metadata
value R The value of the metadata
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Response

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to save an Entity in an Azure Table, called 'mytable', through HTTP using C#.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/azurestorage/saveentity"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("tablename", "mytable"); wr.Headers.Add("data", "<root><PartitionKey>001</PartitionKey><RowKey>abc</RowKey><Age type='int'>19</Age></root>"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to save an Entity in an Azure Table, called 'mytable', using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/azurestorage/saveentity" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'tablename':'mytable', 'data':'<root><PartitionKey>001</PartitionKey><RowKey>abc</RowKey><Age type=\'int\'>19</Age></root>', 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to save an Entity in an Azure Table, called 'mytable', using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/azurestorage/saveentity HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname data: <root><PartitionKey>001</PartitionKey><RowKey>abc</RowKey><Age type='int'>19</Age></root> tablename: mytable

This example shows you how to save an Entity in an Azure Table, called 'mytable', using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/azurestorage/saveentity"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("tablename", "mytable"); client.set_header("data", "<root><PartitionKey>001</PartitionKey><RowKey>abc</RowKey><Age type='int'>19</Age></root>"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Database Proxy

The Database Proxy service allows you to query SQL Server, Azure SQL Database and MySQL databases.

MySQL connectivity requires using the MySQL ODBC 5.3 driver.

Commands

Name Description
ExecuteSql POST Executes any valid SQL statement against the destination database details 


/bsc/db/executesql

HTTP Headers

Name Description
sql R A valid SQL statement to execute that may or may not return data
_config R The name of the configuration to use
execTimeout An optional timeout value that overrides the default setting
_cols Optional list of columns to return from the SQL result set
_where Optional WHERE clause to apply as a filter on the SQL result set
_maxattempts Number of maximum service call retries if timeout detected

HTTP Response

The list of properties being returned is dynamic and depends on the SQL statement executed. If the SQL commands returns 0 records, the /data/Table/ node will be empty.

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "ExecuteSql": [ {
            "Col1": "val1",
            "Col2": "val2"
            },
            {
            "Col1": "val3",
            "Col2": "val4"
            },
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetTable GET Executes a SELECT command against a specific table in the destination details 


/bsc/db/gettable

HTTP Headers

Name Description
tablename R The name of a database view or table
_config R The name of the configuration to use
execTimeout An optional timeout value that overrides the default setting
_cols Optional list of columns to return from the SQL result set
_where Optional WHERE clause to apply as a filter on the SQL result set
_maxattempts Number of maximum service call retries if timeout detected

HTTP Response

The list of properties being returned is dynamic and depends on the SQL statement executed. If the SQL commands returns 0 records, the /data/Table/ node will be empty.

The /result/resultCode property will be 0 for successful calls. When non-zero, the /result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetTable": [ {
            "Col1": "val1",
            "Col2": "val2"
            },
            {
            "Col1": "val3",
            "Col2": "val4"
            },
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to send an HTTP request to Enzo Online using C#; the command executes against the DB Proxy adapter and calls the ExecuteSQL command against the configured database proxy.
To successfully run this sample code, you must have configured a DB Proxy and a Central Connection String that points to a SQL Server database server (the SQL command provided is specific to SQL Server).
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/db/executesql"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Create a SQL command as a string that the database understands string sql = "SELECT * FROM sys.tables"; // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("sql", sql); wr.Headers.Add("_config", "dbproxy1"); wr.Method = "GET"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { System.IO.StreamReader reader = new System.IO.StreamReader(stream); string json = reader.ReadToEnd(); // The response is a JSON object // The json response structure looks like this: // {"response": {"executesql": { ... }}} } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to execute a SQL command using HTTP in Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/db/executesql" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken':enzoguid, 'sql':'SELECT * FROM sys.tables', '_config': 'myconfigname' } response=requests.get(enzourl_receiveMsg,headers=headers) resp=response.json() if (len(resp['data']['Table1']) > 0 #extract message here…

This example shows you a simple HTTPS request executing a SQL statement against the Database Proxy adapter (db). The _config header points to the DB Proxy that will be used to connect to the database. An additional pamater (exectimeout) is included in the HTTP Header to override the default timeout value.


GET ENZO_URI:ENZO_PORT/bsc/db/executesql HTTP/1.1 authToken: YOUR_AUTH_TOKEN sql: SELECT * FROM sys.tables _config: dbproxy1 exectimeout: 15

This example shows you how to execute an SQL statement using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/db/executesql"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("sql", "select * from sys.tables"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



FTP

The FTP service allows you to access and manage files on an existing FTP server.

Commands

Name Description
Append POST Appends data at the end of a file using the default connection file type (binary or ascii). details 


/bsc/ftp/append

HTTP Headers

Name Description
fileName R The name of the file
content R The content to append
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Append_Ascii POST Appends data at the end of an ascii file. details 


/bsc/ftp/append_ascii

HTTP Headers

Name Description
fileName R The name of the file
content R The content to append
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Append_Binary POST Appends data at the end of a binary file. details 


/bsc/ftp/append_binary

HTTP Headers

Name Description
fileName R The name of the file
content R The content to append
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Delete POST Deletes a file. details 


/bsc/ftp/delete

HTTP Headers

Name Description
fileName R The name of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Dir GET Lists the content of a directory. details 


/bsc/ftp/dir

HTTP Headers

Name Description
_config R The name of the configuration to use
name The name of the directory (send null for the root directory)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Dir": [ {"FileName": "test1.txt"}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Directories GET List directories under the path provided. details 


/bsc/ftp/directories

HTTP Headers

Name Description
_config R The name of the configuration to use
name The path under which to list available directories (leave null for the root directory)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Directories": [ { "FileName": "images" } ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Get GET Gets the content of a file using the default connection file type (binary or ascii). details 


/bsc/ftp/get

HTTP Headers

Name Description
fileName R The name of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Get": [ { "Content": "content of the file" } ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Get_Ascii GET Gets the content of an ascii file. details 


/bsc/ftp/get_ascii

HTTP Headers

Name Description
fileName R The name of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Get_Ascii": [ { "Content": "content of the file" } ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Get_Binary GET Gets the content of a binary file. details 


/bsc/ftp/get_binary

HTTP Headers

Name Description
fileName R The name of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Get_Binary": [{ "Content": "Y29udGVudCBvZiB0aGUgZmlsZQ==" }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ls GET Lists the files in a directory. details 


/bsc/ftp/ls

HTTP Headers

Name Description
_config R The name of the configuration to use
name The name of the directory (send null for the root directory)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "ls": [ { "FileName": "test1.txt" } ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
mkdir POST Creates a new directory from the current working directory. details 


/bsc/ftp/mkdir

HTTP Headers

Name Description
name R The name of the directory
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
put POST Creates a file using the default connection file type (binary or ascii). details 


/bsc/ftp/put

HTTP Headers

Name Description
fileName R The name of the file
content R The content of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
put_ascii POST Creates an ascii file. details 


/bsc/ftp/put_ascii

HTTP Headers

Name Description
fileName R The name of the file
content R The content of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
put_binary POST Creates a binary file. details 


/bsc/ftp/put_binary

HTTP Headers

Name Description
fileName R The name of the file
content R The content of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
rename POST Renames a file. details 


/bsc/ftp/rename

HTTP Headers

Name Description
fileName R The original file name
newName R The new file name
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
rmdir POST Deletes a directory from the current working directory. details 


/bsc/ftp/rmdir

HTTP Headers

Name Description
name R The name of the directory
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
size GET Gets the size of a file. details 


/bsc/ftp/size

HTTP Headers

Name Description
fileName R The name of the file
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "size": [ {"Size": 1024} ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to list files on an FTP server through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/ftp/ls"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("_config", "myconfigname"); wr.Method = "GET"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to list files on an FTP server through HTTP using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/ftp/ls" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.get(enzourl_receiveMsg,headers=headers)

This example shows you how to list files on an FTP server through HTTP.


GET ENZO_URI:ENZO_PORT/bsc/ftp/ls HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname

This example shows you how to list files on an FTP server through HTTP using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/ftp/ls"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Loggly

The Loggly service allows you to forward application events and errors to Loggly through a central communication endpoint.

Commands

Name Description
Log POST Forwards an application event to Loggly and transforms the message as a JSON document automatically. details 


/bsc/loggly/log

HTTP Headers

Name Description
message R The message to log.
_config R The name of the configuration to use
severity  The severity of the message. Usually DEBUG, INFO, WARNING, ERROR. If not provided, will default to INFO.
deviceId  The device id sending the message.
facility  The application identifier sending the message.
timestamp  The timestamp of the message. If null, the server timestamp will be used.
tags  Comma-separated list of tags to attach to this event.
_maxattempts Number of maximum service call retries if timeout detected
LogJson POST Forwards an application event already formatted as a JSON document to Loggly. details 


/bsc/loggly/logjson

HTTP Headers

Name Description
message R The JSON document to log
_config R The name of the configuration to use
tags  Comma-separated list of tags to attach to this event.
_maxattempts Number of maximum service call retries if timeout detected
LogDebug, LogInfo,LogWarning,LogError POST Forwards an application event to Loggly, sets the severity accordingly, and transforms the message as a JSON document automatically. details 


/bsc/loggly/logdebug

HTTP Headers

Name Description
message R The message to log.
_config R The name of the configuration to use
deviceId  The device id sending the message.
facility  The application identifier sending the message.
timestamp  The timestamp of the message. If null, the server timestamp will be used.
tags  Comma-separated list of tags to attach to this event.
_maxattempts Number of maximum service call retries if timeout detected

Sample Code

This example shows you how to forward a log message using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/loggly/log"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("message", "This is a sample message"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to forward a log message using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/loggly/log" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken': enzoguid, 'message': 'This is a sample log message; could be sent using the Body of the REST call as well', '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to forward a log message using raw HTTP.


POST ENZO_URI:ENZO_PORT/bsc/loggly/log HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname message: This is a test message

This example shows you how to forward a log message using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/loggly/log"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("message", "This is a test message"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Messaging

The Messaging service allows you to send emails and text messages through an existing service provider using their email system.

Commands

Name Description
SendSMTP POST Sends an email to one or more recipients. details 


/bsc/messaging/sendsmtp

HTTP Headers

Name Description
fromEmail R Email address of sender.
recipients R Comma-separated list of recipient emails.
subject R Subject of the email.
message R The body of the message to send.
_config R The name of the configuration to use
ccs Comma-separated list of CC recipient emails
bccs Comma-separated list of BCC recipient emails
attachment1
attachment2...
attachment10
Optional attachments to the email. The file(s) must be attached as a POST request in the body of the request and the HTTP Content Type must be set to 'multipart/form-data'
_maxattempts Number of maximum service call retries if timeout detected
SendText POST Sends a SMS text message to one or more recipients using a cell provider's email system.
Only a limited number of providers is supported: Verizon, ATT, Comcast, MCI, Nexttel, Orange, Sprint, TMobile, USCellular... please contact us for the full list. details 


/bsc/messaging/sendtext

HTTP Headers

Name Description
carrier R The name of the carrier to use
phones R Comma-separated list of phone numbers to send the text message to
message R The message to send
subject An optional subject.
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Sample Code

This example shows you how to send a text message through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/messaging/sendtext"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("phones", "1111111111,2222222222"); wr.Headers.Add("carrier", "tmobile"); wr.Headers.Add("subject", "Test Message"); wr.Headers.Add("message", "This is a sample message"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to send an email through Enzo Online using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/messaging/sendsmtp" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken': enzoguid, 'subject': 'Test Email', 'recipients': 'email001@hotmail.com,email002@hotmail.com', 'message': 'This is a sample email body; could be sent using the Body of the REST call as well', '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to send a text message to two phone numbers.


POST ENZO_URI:ENZO_PORT/bsc/messaging/sendtext HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname phones: 1111111111,2222222222 carrier: tmobile subject: Test SMS message: This is a test message

This example shows you how to send a text message using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/messaging/sendtext"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("carrier", "tmobile"); client.set_header("phones", "1111111111,2222222222"); client.set_header("subject", "Test SMS"); client.set_header("message", "This is a test message"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



SalesForce

The SalesForce service allows you to access and manage records stored in existing SalesForce tables.

Commands

Name Description
DeleteRaw POST Deletes one or more record in SalesForce based on an XML document using the record Id (must be provided) details 


/bsc/salesforce/deleteraw

HTTP Headers

Name Description
table R The name of the SalesForce table to use
data R The raw data (XML) to use
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "DeleteRaw": [{
            "outcome": "success",
            "message": "abcdef..."
            }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSFDeletedObjects GET Retrieves the list of SalesForce object that were deleted within a specific timeframe details 


/bsc/salesforce/getsfdeletedobjects

HTTP Headers

Name Description
objectName R The name of the SalesForce object
_config R The name of the configuration to use
startDate The range start date (max is 30 days ago)
endDate The range end date
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSFDeletedObjects": [{
            "Id": "abcdef",
            "deletedDate": "",
            "earliestDateAvailable": "",
            "latestDateCovered": "",
            "objectName": "",
            "startDate": "",
            "endDate": ""
            }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSFMetadata GET Retrieves the list of SalesForce object fields details 


/bsc/salesforce/getsfmetadata

HTTP Headers

Name Description
objectName R The name of the SalesForce object
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSFMetadata": [{
            "name",
            "fieldType": "string",
            "label": "First Name",
            "autonumber": false,
            "custom": false,
            "calculated": false,
            "calculatedFormula": "",
            "length" = 0,
            "mask": "",
            "maskType": "",
            "nameField": false,
            "precision":0,
            "unique": false,
            "scale": 0,
            "pickValues": "",
            "refFields": "",
            "objectName": ""
            }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSFObjects GET Retrieves the list of SalesForce objects details 


/bsc/salesforce/getsfobjects

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSFObjects": [{
            "name": "firstName",
            "label": "First Name",
            "labelPlural": "First Name",
            "keyPrefix": ""
        }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetSFUpdatedObjects GET Retrieves the list of SalesForce object that were inserted or updated within a specific timeframe details 


/bsc/salesforce/getsfupdatedobjects

HTTP Headers

Name Description
objectName R The name of the SalesForce object
_config R The name of the configuration to use
startDate The range start date (max is 30 days ago)
endDate The range end date
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetSFUpdatedObjects": [{
            "Id": "abcdef...",
            "latestDateCovered": "",
            "objectName": "John Doe",
            "startDate": "",
            "endDate": ""
            }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
InsertRaw POST Inserts one or more record in SalesForce based on an XML document details 


/bsc/salesforce/insertraw

HTTP Headers

Name Description
table R The name of the SalesForce table to use
data R The raw data (XML) to use: or
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "InsertRaw": [{
            "outcome": "success",
            "message": "abcdef..."
        }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Query GET Executes a SOQL query details 


/bsc/salesforce/query

HTTP Headers

Name Description
soql R SalesForce Object Query statement
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Query": [{
        -- LIST OF PROPERTIES RETURNED DEPENDS ON SOQL --
        }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
UpdateRaw POST Updates one or more records in SalesForce based on an XML document using the record Id (must be provided) details 


/bsc/salesforce/updateraw

HTTP Headers

Name Description
table R The name of the SalesForce table to use
data R The raw data (XML) to use: or
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "UpdateRaw": [{
            "outcome": "success",
            "message": "abcdef..."
        }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to read a SalesForce record through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/salesforce/query"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("soql", "SELECT Id,Name, Active__c, AccountNumber, Owner.Name, CreatedDate FROM Account"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "GET"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to read a SalesForce record using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/salesforce/query" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken': enzoguid, 'soql': 'SELECT Id,Name, Active__c, AccountNumber, Owner.Name, CreatedDate FROM Account', '_config': 'myconfigname' } response=requests.get(enzourl_receiveMsg,headers=headers)

This example shows you how to read a SalesForce record using raw HTTP.


GET ENZO_URI:ENZO_PORT/bsc/salesforce/query HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname soql: SELECT Id,Name, Active__c, AccountNumber, Owner.Name, CreatedDate FROM Account

This example shows you how to read a SalesForce record using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/salesforce/query"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("soql", "SELECT Id,Name, Active__c, AccountNumber, Owner.Name, CreatedDate FROM Account"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



SharePoint

The SharePoint service allows you to access and manage items and documents stored in existing SharePoint lists and manage object and user permissions.

Commands

Name Description
AddDocument POST Adds a document as a byte array to a SharePoint Library details 


/bsc/sharepoint/adddocument

HTTP Headers

Name Description
title R The title or the id of the list
fileName R The relative path and file name
overrideFile R Set to true to override the file
content R A binary stream of data to save as a document
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
AddField POST Adds a new field to a list in SharePoint details 


/bsc/sharepoint/addfield

HTTP Headers

Name Description
title R The title or id of the list
name R The name of the field to add
_config R The name of the configuration to use
type The type of the field (Number, Currency, Guid, URL, User, Choice, Text, Note, DateTime)
defaultValue A default value for the field
options Options specific to the field type (currency: a valid LCID (locale id); datetime: date, datetime; note: richtext, plaintext; text: max length (int); url:image, hyperlink; choice: list of comma-separated values; user: peopleonly, peopleandgroups)
unique Sets the unique flag for this field (0=no, 1=yes)
required Sets the required flag for this field (0=no, 1=yes)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
AddGroupUser POST Adds a user to a security group details 


/bsc/sharepoint/addgroupuser

HTTP Headers

Name Description
name R The name of the group
userInfo R The Email or LoginName of an existing user
_config R The name of the configuration to use
noError True to silence errors
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
AddListItemRaw POST Inserts an item into an existing SharePoint list. details 


/bsc/sharepoint/addlistitemraw

HTTP Headers

Name Description
name R The name of the list to add an item to
_config R The name of the configuration to use
data An XML string or a JSon document (to insert multiple records, send a JSon document containing an array of documents) (fields are case sensitive)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
AddTextDocument POST Adds a document as a byte array to a SharePoint Library details 


/bsc/sharepoint/addtextdocument

HTTP Headers

Name Description
title R The title or the id of the list
fileName R The relative path and file name
overrideFile R Set to true to override the file
content R A string to save as a document
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ClearFieldCache POST Clears the field cache of a SharePoint list, or all lists details 


/bsc/sharepoint/clearfieldcache

HTTP Headers

Name Description
_config R The name of the configuration to use
title The title or the id of the list (send null to clear the cache for all lists)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateFolder POST Creates a folder in a sharepoint list details 


/bsc/sharepoint/createfolder

HTTP Headers

Name Description
title R The title or the id of the list
folderName R The name of the folder
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CreateList POST Creates a new list in SharePoint details 


/bsc/sharepoint/createlist

HTTP Headers

Name Description
title R The title of the list
template R The template to use (GenericList, DocumentLibrary, Survey, Links, Announcements, Contacts, Posts, Events, Tasks, PictureLibrary... (See ListTemplateType SharePoint object type for reference))
_config R The name of the configuration to use
description The description of the list
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteDocument POST Deletes a document from a SharePoint Library details 


/bsc/sharepoint/deletedocument

HTTP Headers

Name Description
title R The title or the id of the list
fileName R The relative path and file name
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteField POST Deletes a field from a list in SharePoint details 


/bsc/sharepoint/deletefield

HTTP Headers

Name Description
title R The title or id of the list
fieldName R The Title, Internal Name or Id of the field
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteFolder POST Deletes a folder in a sharepoint list details 


/bsc/sharepoint/deletefolder

HTTP Headers

Name Description
title R The title or the id of the list
folderName R The name of the folder
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteList POST Deletes a list in SharePoint details 


/bsc/sharepoint/deletelist

HTTP Headers

Name Description
title R The title or the id of the list
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
DeleteListItemRaw POST Deletes one or more list items into an existing SharePoint list. details 


/bsc/sharepoint/deletelistitemraw

HTTP Headers

Name Description
name R The name of the list to delete an item from
_config R The name of the configuration to use
where A SQL WHERE clause that identifies the records to be deleted (fields are case sensitive)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetField GET Returns the properties of a single field of a list in SharePoint details 


/bsc/sharepoint/getfield

HTTP Headers

Name Description
title R The title or id of the list
fieldName R The Title, Internal Name or Id of the field
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetField": [{
                "title": "Created",
                "fieldName": "Created_x0020_Date"
            }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetFields GET Returns the list of fields of a list in SharePoint details 


/bsc/sharepoint/getfields

HTTP Headers

Name Description
title R The title or id of the list
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetFields": [
                { "title": "ID" },
                { "title": "Title" },
                { "title": "Modified" },
                { "title": "Created" }
            ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetFoldersWithRoles GET Gets a list of folders in a list including the assigned folder roles. details 


/bsc/sharepoint/getfolderswithroles

HTTP Headers

Name Description
title R The name of the list to query
_config R The name of the configuration to use
folder The name of the folder (null to retrieve all folders)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetFoldersWithRoles": [{
                "id": "1",
                "title": "mylist",
                "folder": "/folder",
                "serverRelativeURL": "/folder",
                "roleAssignments": "read",
                "hasUniqueRoleAssignments": false
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetGroups GET Gets the list of groups. details 


/bsc/sharepoint/getgroups

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetGroups": [{
                    "groupId": "10",
                    "groupTitle": "mygroup",
                    "userCount": 1
                }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetGroupUsers GET Gets a list of users that belong to a group. details 


/bsc/sharepoint/getgroupusers

HTTP Headers

Name Description
name R The name of the group
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetGroupUsers": [{
                    "groupId": "10",
                    "groupTitle": "mygroup",
                    "loginName": "johndoe",
                    "email": "johndoe@email.com",
                    "userTitle": "John Doe",
                }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetListChanges GET Gets a list of changes made to a SharePoint List. details 


/bsc/sharepoint/getlistchanges

HTTP Headers

Name Description
name R The name of the list
_config R The name of the configuration to use
changeType The type of change to filter on (add, delete, update). Leave blank to return all changes.
changeToken The last change token retrieved previously to retrieve changes from this point on. Leave blank for all changes.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetListChanges": [{
            "itemId": 1,
            "dateChanged": 2017-10-10T08:00:00.000Z,
            "changeType": "update",
            "changeToken": "token"
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetListItemsEx GET Get items from an existing SharePoint list (or view) details 


/bsc/sharepoint/getlistitemsex

HTTP Headers

Name Description
viewName R The name of the view to use. By default uses the default view.
_config R The name of the configuration to use
columns A case-sensitive list of columns to return. Send an empty string, or *, to return all columns.
where A SQL where clause that is used to filter the output
top Maximum number of records to return
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetListChanges": [ {
                # List of properties varies based on query/filter
            } ]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetUserGroups GET Gets a list of groups a user belongs to. details 


/bsc/sharepoint/getusergroups

HTTP Headers

Name Description
_config R The name of the configuration to use
user The user email or LoginName
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetUserGroups": [{
                    "user": "johndoe@email.com",
                    "userName": "John Doe",
                    "groupId": "10",
                    "groupName": "mygroup"
                }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetUserPermissions GET Gets a list of effective user permissions for a specific SharePoint securable such as a list or folder. details 


/bsc/sharepoint/getuserpermissions

HTTP Headers

Name Description
title R The title of the list
_config R The name of the configuration to use
folder The path to the folder (for Document lists)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetUserPermissions": [{
                    "title": "document1",
                    "folder": "/documents",
                    "loginName": "johndoe@email.com",
                    "role": "mygroup"
                }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetUsers GET Gets a list of users in the SharePoint site. details 


/bsc/sharepoint/getusers

HTTP Headers

Name Description
_config R The name of the configuration to use
id
Title
email
LoginName
IsSiteAdmin
PrincipalType
NameId
NameIdIssuer
Groups
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetUsers": [{
                "id": "johndoe",
                "title": "John Doe",
                "email": "johndoe@email.com",
                "loginName": "johndoe@email.com",
                "isSiteAdmin": false,
                "PrincipalType": "",
                "NameId": "",
                "NameIdIssuer": "",
                "groups": "mygroup1,mygroup2"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListDocuments GET Gets a list of documents in the given document list. details 


/bsc/sharepoint/listdocuments

HTTP Headers

Name Description
title R The title of the list
_config R The name of the configuration to use
folder The name of the folder to inspect. Send null to return all documents and folders from the root
recursive True if the query should include all documents below the folder provided
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "ListDocuments": [{
                "id": "1",
                "title": "mylist",
                "contentType": "Documents",
                "name": "file1.txt",
                "authorLogin": "johndoe@email.com",
                "modifiedBy": "johndoe@email.com",
                "timeLastModified": 2017-10-10T08:00:000Z,
                "serverRelativeUrl": "/file1.txt"
            }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Lists GET Get information about the available lists in the current SharePoint endpoint details 


/bsc/sharepoint/lists

HTTP Headers

Name Description
_config R The name of the configuration to use
title The title or the Id of the list (optional)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Lists": [{
            "Id": "1", 
            "Title": "mylist", 
            "Description"" null, 
            "Created":  2017-10-10T08:00:000Z, 
            "BaseType": "Documents", 
            "DefaultView": "_default", 
            "VersioningEnabled": false, 
            "ForceCheckout": false, 
            "Hidden": false, 
            "ItemCount": 125
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
RemoveGroupUser POST Removes a user from a security group details 


/bsc/sharepoint/removegroupuser

HTTP Headers

Name Description
name R The name of the group
userInfo R The Email or LoginName of an existing user
_config R The name of the configuration to use
noError True to silence errors
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
RenameFolder POST Updates a folder in a sharepoint list details 


/bsc/sharepoint/renamefolder

HTTP Headers

Name Description
title R The title or the id of the list
folderName R The name of the folder
newFolderName R The name of the folder
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Sites GET Get information about the available sites for the current SharePoint endpoint details 


/bsc/sharepoint/sites

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "Sites": [{
            "Id": "1", 
            "Title": "mysite", 
            "Description"" null, 
            "Created":  2017-10-10T08:00:000Z, 
            "URL": "https://..."
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
UpdateListItemRaw POST Updates one or more items in an existing SharePoint list. details 


/bsc/sharepoint/updatelistitemraw

HTTP Headers

Name Description
name R The name of the list
_config R The name of the configuration to use
data An XML string or a JSon document (fields are case sensitive)
where A SQL WHERE clause that selects which records will be updated
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
WebApplication GET Get information about the current SharePoint endpoint details 


/bsc/sharepoint/webapplication

HTTP Headers

Name Description
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "WebApplication": [{
            "Id": "1", 
            "Title": "myapp", 
            "Description"" null, 
            "Created":  2017-10-10T08:00:000Z, 
            "URL": "https://..."
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetDocument GET Reads a document from a SharePoint Library details 


/bsc/sharepoint/getdocument

HTTP Headers

Name Description
title R The title or the id of the list
fileName R The relative path and file name
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetDocument": [{
            "content": "Y29udGVudA==", 
            "eTag": "2e09c964-b720-47fa-baed-a34d70691f4f"
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetDocumentAt GET Reads a document as a binary file from a SharePoint Library from a relative server path or document library path URL details 


/bsc/sharepoint/getdocumentat

HTTP Headers

Name Description
url R The relative path of the document in SharePoint
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetDocumentAt": [{
            "content": "Y29udGVudA==", 
            "eTag": "2e09c964-b720-47fa-baed-a34d70691f4f"
        }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetTextDocument GET Reads a document from a SharePoint Library details 


/bsc/sharepoint/gettextdocument

HTTP Headers

Name Description
title R The title or the id of the list
fileName R The relative path and file name
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetTextDocument": [{
            "content": "The content of the document", 
            "eTag": "2e09c964-b720-47fa-baed-a34d70691f4f"
    }]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
GetTextDocumentAt GET Reads a document as a text output from a SharePoint Library from a relative server path or document library path URL details 


/bsc/sharepoint/gettextdocumentat

HTTP Headers

Name Description
url R The relative path of the document in SharePoint
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The/result/resultCode property will be 0 for successful calls. When non-zero, the/result/resultMsg property will contain additional information about the error.

{
    "results": {
        "GetTextDocumentAt": [{
            "content": "The content of the document", 
            "eTag": "2e09c964-b720-47fa-baed-a34d70691f4f"
    }]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to read a SharePoint list through HTTP using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/sharepoint/getlistitemsex"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("viewname", "mylist"); wr.Headers.Add("where", "State='FL'"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "GET"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to read a SharePoint list using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/sharepoint/getlistitemsex" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={ 'authToken': enzoguid, 'viewname': 'mylist', 'where': 'State=''FL''', '_config': 'myconfigname' } response=requests.get(enzourl_receiveMsg,headers=headers)

This example shows you how to read a SharePoint list using raw HTTP.


GET ENZO_URI:ENZO_PORT/bsc/sharepoint/getlistitemsex HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname viewname: mylist where: State='FL'

This example shows you how to read a SharePoint list using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/sharepoint/getlistitemsex"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_GET, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("viewname", "mylist"); client.set_header("where", "State='FL'"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Threading

The Threading service allows you to manage concurrency between multiple disconnected systems, such as locking and calculate future rally points for losely coupled device synchronization.

Commands

Name Description
ListLocks GET Lists active global lock in a given group. details 


/bsc/threading/listlocks

HTTP Headers

Name Description
_config R The name of the configuration to use
name The name of the lock to filter by
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListLocks": [
            {
                "name": "myGlobalLock001",
                "owner": "e4023ca4-12a4-408e-bb66-879f489fb64d",
                "expired": false,
                "expiresIn": 485.63279320000004,
                "lockAcquiredOn": "2018-01-05T14:33:12.6707467",
                "lockedFor": 114.36720679999999,
                "tag": null
            }
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Lock POST Create a global lock. details 


/bsc/threading/lock

HTTP Headers

Name Description
name R The name of the lock to create (use #guid() to generate a random name)
_config R The name of the configuration to use
owner Owner of the lock (use #guid() to generate a random owner); only the owner can unlock; leave empty if anyone can unlock
expiresInSec The expiration window of the lock (default: uses the default timeout configuration setting)
tag Custom tag used to store system/device-specific information
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "Lock": [
            {
                "name": "myGlobalLock001",
                "owner": "e4023ca4-12a4-408e-bb66-879f489fb64d"
            }
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": null
    }    
}
SlideTTLLock POST Slides the timeout window of a global lock by the specified number of seconds. details 


/bsc/threading/slidettllock

HTTP Headers

Name Description
name R The name of the lock to update
_config R The name of the configuration to use
owner The owner of the lock
slideBySec The number of seconds the expiration window should be expanded by
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
Unlock POST Releases a global lock. details 


/bsc/threading/unlock

HTTP Headers

Name Description
name R The name of the lock to release
_config R The name of the configuration to use
owner The owner of the lock
silenceErrors Silence errors if the lock has already been released or is not found
_maxattempts Number of maximum service call retries if timeout detected

Http Response

This call does not return data.

{
    "results": null,
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
CalculateRally GET Calculates the number of milliseconds to wait until the next rally point. details 


/bsc/threading/calculaterally

HTTP Headers

Name Description
_config R The name of the configuration to use
duration Optional CRON expression indicating a rally point in the future (ex (top of the next 5 min increment): 0 */5 * ? * * ); if missing, uses the defaultSleep configuration setting if provided as a CRON expression
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "CalculateRally": [
            {
                "clientWaitTimeMs": 12142,
                "fromDate": "2018-01-05T14:31:48",
                "fromEpoch": 1515162708000
            }
        ]
    },
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to obtain a global lock for 60 seconds using a random Guid for its name and owner using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/threading/lock"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("name", "#guid()"); wr.Headers.Add("owner", "#guid()"); wr.Headers.Add("expiresInSec", "60"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to obtain a global lock for 60 seconds using a random Guid for its name and owner using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/threading/lock" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'name':'#guid()', 'owner': '#guid()', 'expiresInSec': 60, 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to obtain a global lock for 60 seconds using a random Guid for its name and owner using RAW HTTP.


POST ENZO_URI:ENZO_PORT/bsc/threading/lock HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname name: #guid() owner: #guid() expiresInSec: 60

This example shows you how to obtain a global lock for 60 seconds using a random Guid for its name and owner using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/threading/lock"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("name", "#guid()"); client.set_header("owner", "#guid()"); client.set_header("expiresInSec", "60"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Twilio

The Enzo Twilio service allows you to send SMS messages and make phones calls using Twilio. Using this service requires a Twilio account.

Commands

Name Description
ListCall GET List details of a single call. details 


/bsc/twilio/listcall

HTTP Headers

Name Description
sid R A specific call identifier to retrieve
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListCall": [{
                        "Sid": " ",
                        "ParentCallSid": " ",
                        "DateCreated": " ",
                        "DateUpdated": " ",
                        "AccountSid": " ",
                        "To": " ",
                        "From": " ",
                        "PhoneNumberSid": " ",
                        "Status": " ",
                        "StartTime": " ",
                        "EndTime": " ",
                        "Duration": ,
                        "Price": ,
                        "Direction": " ",
                        "AnsweredBy": " ",
                        "ForwardedFrom": " ",
                        "CallerName": " ",
                        "Uri": " "}]
},
   "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListCalls GET Phone calls made to and from an account. details 


/bsc/twilio/listcalls

HTTP Headers

Name Description
_config R The name of the configuration to use
startTime Only show calls that started from this date/time. Default is UTC midnight today.
endTime Only show calls that ended by this date/time
fromPhone Only show calls from this phone number
toPhone Only show calls to this phone number
status Only show calls currently in this status
parentCallSid Only show calls that belong to this parent call (e.g. Dial legs)
page Page number to start retrieving results
maxRows Maximum number of rows to return. Use TOP N if using SELECT.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListCalls": [{
                        "Sid": " ",
                        "ParentCallSid": " ",
                        "DateCreated": " ",
                        "DateUpdated": " ",
                        "AccountSid": " ",
                        "ToPhone": " ",
                        "FromPhone": " ",
                        "PhoneNumberSid": " ",
                        "Status": " ",
                        "StartTime": " ",
                        "EndTime": " ",
                        "Duration": ,
                        "Price": ,
                        "Direction": " ",
                        "AnsweredBy": " ",
                        "ForwardedFrom": " ",
                        "CallerName": " ",
                        "Uri": " ",
                        "Page": " ",
                        "PageSize": " ",
                        "Start": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListMessage GET List details of a single message. details 


/bsc/twilio/listmessage

HTTP Headers

Name Description
sid R A specific message identifier to retrieve
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListMessage": [{
                        "Sid": " ",
                        "DateCreated": " ",
                        "DateUpdated": " ",
                        "AccountSid": " ",
                        "To": " ",
                        "From": " ",
                        "Status": " ",
                        "NumSegments": " ",
                        "DateSent": " ",
                        "Price": ,
                        "Direction": " ",
                        "Uri": " ",
                        "ErrorCode": " ",
                        "ErrorMessage": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListMessages GET Messages sent to and from an account. details 


/bsc/twilio/listmessages

HTTP Headers

Name Description
_config R The name of the configuration to use
dateSent Only show messages sent beginning on this date/time. Default is UTC midnight today.
fromPhone Only show calls from this phone number
toPhone Only show calls to this phone number
page Page number to start retrieving results
maxRows Maximum nuber of rows to return. Use TOP N if using SELECT.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListMessages": [{
                        "Sid": " ",
                        "DateCreated": " ",
                        "DateUpdated": " ",
                        "AccountSid": " ",
                        "To": " ",
                        "From": " ",
                        "Status": " ",
                        "NumSegments": " ",
                        "DateSent": " ",
                        "Price": ,
                        "Direction": " ",
                        "Uri": " ",
                        "ErrorCode": " ",
                        "ErrorMessage": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
ListUsage GET Retrieve usage made by your Twilio account during any time period and by any usage category. details 


/bsc/twilio/listusage

HTTP Headers

Name Description
_config R The name of the configuration to use
category Category of usage
interval The time unit used to group the usage data. Possible values are: Daily, Monthly, Yearly, AllTime, Today, Yesterday, ThisMonth, and LastMonth.
startDate Only include usage that has occurred on or after this date
endDate Only include usage that has occurred on or before this date.
page Page number to start retrieving results
maxRows Maximum nuber of rows to return. Use TOP N if using SELECT.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "ListUsage": [{
                        "Category": " ",
                        "Description": " ",
                        "AccountSid": " ",
                        "StartDate": " ",
                        "EndDate": " ",
                        "Usage": ,
                        "UsageUnit": " ",
                        "Count": ,
                        "CountUnit": " ",
                        "Price": ,
                        "PriceUnit": " ",
                        "Uri": " ",
                        "Page": " ",
                        "PageSize": " ",
                        "Start": " ",
                        "Interval": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SendMms POST Send an MMS message with an attached image. details 


/bsc/twilio/sendmms

HTTP Headers

Name Description
phones R One or more phone numbers to call separated by semi-colons (";").
message R The text of the message you want to send, limited to 160 characters.
mimeType R image/gif, image/png, image/jpeg, etc. mime-types
mimeFilespec R File to send. If initiating via REST, do not add argument as a header, but instead attach as a file to the POST request specifying a Content-Type of 'multipart/form-data'.
_config R The name of the configuration to use
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "SendMms": [{
                        "From": " ",
                        "To": " ",
                        "Status": " ",
                        "DateCreated": " ",
                        "DateSent": " ",
                        "Direction": " ",
                        "Price": ,
                        "Sid": " ",
                        "Uri": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SendSms POST Send an SMS message. details 


/bsc/twilio/sendsms

HTTP Headers

Name Description
phones R One or more phone numbers to call separated by semi-colons (";").
message R The text of the message you want to send, limited to 1600 characters.
_config R The name of the configuration to use
from The phone number, SIP address or Client identifier that made this call. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formated as name@company.com. Client identifiers are formatted client:name. Default uses configured setting for LoginId.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "SendSms": [{
                        "Sid": " ",
                        "DateCreated": " ",
                        "DateUpdated": " ",
                        "AccountSid": " ",
                        "To": " ",
                        "From": " ",
                        "Status": " ",
                        "NumSegments": " ",
                        "DateSent": " ",
                        "Price": ,
                        "Direction": " ",
                        "Uri": " ",
                        "ErrorCode": " ",
                        "ErrorMessage": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}
SendVoiceMsg POST Send a voice message. details 


/bsc/twilio/sendvoicemsg

HTTP Headers

Name Description
phonesToCall R One or more phone numbers to call separated by semi-colons (";"). In addition to the phone number, three additional parameters may be specified with a number: hangupIfMachine, sendDigits, and timeout. For example, "2120000000,1,ww123,15;4150000000,,,30" would call 2120000000 and hang up phone if an answering machine is detected, send two pauses followed by the numbers 1, 2, and 3, and hangup if no one answers after 15 seconds. 4150000000 would wait 30 seconds before haning up if no one answers. Details: hangupIfMachine will hangup the call if an answering machine is detected. sendDigits is a string of keys to dial after connecting to the number. Valid digits in the string include: any digit (0-9), '#', '*' and 'w' (to insert a half second pause). For example, if you connected to a company phone number, and wanted to pause for one second, dial extension 1234 and then the pound key, use SendDigits=ww1234#. imeout is an integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer. Default is 60 seconds, the maximum is 999 seconds. Note, you could set this to a low value, such as 15, to hangup before reaching an answering machine or voicemail.
twiml R Twilio TwiML script
_config R The name of the configuration to use
record Set this parameter to 'true' to record the entirety of a phone call.
from The phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account.
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

{
    "results": {
        "SendVoiceMsg": [{
                        "From": " ",
                        "To": " ",
                        "Status": " ",
                        "StartTime": " ",
                        "EndTime": " ",
                        "Duration": " ",
                        "AnsweredBy": " ",
                        "AccountSid": " ",
                        "Sid": " "}]
},
    "error": {
        "errorCode": 0,
        "errorMsg": ""
    }
}

Sample Code

This example shows you how to make a phone call with Twilio using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/twilio/sendvoicemsg"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("phonesToCall", "1234567890"); wr.Headers.Add("twiml", "<say>hello world.</say>"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to make a phone call with Twilio using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/twilio/sendvoicemsg" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'phonesToCall':'1234567890', 'twiml': '<say>hello world.</say>', 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to make a phone call with Twilio using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/twilio/sendvoicemsg HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname phonesToCall: 1234567890 twiml: <say>hello world.</say>

This example shows you how to make a phone call with Twilio using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/twilio/sendvoicemsg"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("phonesToCall", "1234567890");"); client.set_header("twiml", "<say>hello world.</say>"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }



Twitter

The Enzo Twitter service allows you to send tweets and search recent tweets from the Twitter Timeline. Using this service requires a Twitter account and a registered Application with Twitter (https://apps.twitter.com).

Commands

Name Description
Mentions GET Retrieves recent mentions of the current twitter account details 


/bsc/twitter/mentions

HTTP Headers

Name Description
_config R The name of the configuration to use
count The number of items to retrieve (up to 100)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "mentions": [{
                            "contributors": null,
                            "created_at": "Sat Oct 28 18:15:07 +0000 2017",
                            "created_at_datetime": "2017-12-05T18:22:08",
                            "favorite_count": 0,
                            "favorited": "false",
                            "id": 938111258963927040,
                            "id_str": "938111258963927040",
                            "in_reply_to_screen_name": null,
                            "in_reply_to_status_id": null,
                            "in_reply_to_status_id_str": null,
                            "in_reply_to_user_id": null,
                            "in_reply_to_user_id_str": null,
                            "lang": en,
                            "retweet_count": 2,
                            "retweeted": "true",
                            "source": null,
                            "text": "A tweet message",
                            "truncated": "false"}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
postStatus POST Posts a twitter status to the timeline details 


/bsc/twitter/poststatus

HTTP Headers

Name Description
status R The tweet message to send
_config R The name of the configuration to use
reply_to_id In response to a user handle id
lat Latitude of the tweet
long Longtitude of the tweet
place_id PlaceId of the tweet (see Twitter API for details)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "postStatus": [{
                            "created_at": "Tue Dec 05 18:25:26 +0000 2017",
                            "created_at_datetime": "2017-12-05T18:25:26",
                            "id": 938112090476335104,
                            "id_str": "938112090476335104",
                            "text": "This is a tweet",
                            "source": "source=<a href='http://www.bluesyntax.net\' rel='nofollow'>EnzoAppDev</a>",
                            "truncated": "false",
                            "in_reply_to_status_id": null,
                            "in_reply_to_status_id_str": null,
                            "in_reply_to_user_id": null,
                            "in_reply_to_user_id_str": null,
                            "in_reply_to_screen_name": null,
                            "contributors": null,
                            "retweet_count": 0,
                            "favorite_count": 0,
                            "favorited": "false",
                            "retweeted": "false",
                            "lang": "en"}]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }
search GET Ad-hoc search for tweets given a search criteria details 


/bsc/twitter/search

HTTP Headers

Name Description
contains R A filter to use for tweets
_config R The name of the configuration to use
count The number of tweets to retrieve (up to 100)
locale The locale to search for (us-us)
untildate A maximum date for the search
sinceid The tweet id to search from
maxid The maximum tweet id to search from
lat The latitude of the tweet, or the user's declared latitude
long The longitude of the tweet, or the user's declared longitude
radius The radius of the search
radiustype The type of radius (mi or km)
_maxattempts Number of maximum service call retries if timeout detected

Http Response

The following is a sample response received from a REST call:

    {
        "results": {
            "tweetuser": [{
                "created_at": "Thu Nov 30 20:22:37 +0000 2017",
                "created_at_datetime": "2017-11-30T20:22:37",
                "id": 936329641492611073,
                "id_str": "936329641492611073",
                "text": "A total success!",
                "source": "<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>",
                "truncated": "false",
                "in_reply_to_status_id": 0,
                "in_reply_to_user_id": 0,
                "retweet_count": 4,
                "favorite_count": 0,
                "favorited": "false",
                "retweeted": "false",
                "lang": "en",
                "user_is_translator": "false",
                "user_id": 20806476,
                "user_id_str": "20806476",
                "user_name": null,
                "user_screen_name": null,
                "user_description": "Tech Geek, Occasional Developer",
                "user_url": null,
                "user_followers_count": 0,
                "user_friends_count": 0,
                "user_listed_count": 0,
                "user_created_at": "Fri Feb 13 21:04:39 +0000 2009",
                "user_favourites_count": 0,
                "user_utc_offset": 0,
                "user_time_zone": "Eastern Time (US & Canada)",
                "user_geo_enabled": "false",
                "user_verified": "false",
                "user_statuses_count": 0,
                "user_lang": "en",
                "user_contributors_enabled": "false",
                "user_profile_background_color": "352726",
                "user_profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
                "user_profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
                "user_profile_background_tile": "false",
                "user_profile_image_url": "http://pbs.twimg.com/profile_images/683139549208297472/PbvvWRR0_normal.jpg",
                "user_profile_image_url_https": "https://pbs.twimg.com/profile_images/683139549208297472/PbvvWRR0_normal.jpg",
                "user_profile_link_color": "D02B55",
                "user_profile_sidebar_border_color": "829D5E",
                "user_profile_sidebar_fill_color": "99CC33",
                "user_profile_text_color": "3E4415",
                "user_profile_use_background_image": "false",
                "user_default_profile": "false",
                "user_default_profile_image": "false",
                "user_following": "False",
                "user_follow_request_sent": "false",
                "user_notifications": "False",
                "hashtags_text": null,
                "urls_url": null,
                "urls_expanded_url": null,
                "urls_display_url": null,
                "mention_screen_name": "ideacentermdc",
                "mention_name": "The Idea Center",
                "mention_id": "2742278508",
                "mention_id_str": "2742278508",
                "coordinates_latitude": null,
                "coordinates_longitude": null,
                "place_id": null,
                "place_url": null,
                "place_place_type": null,
                "place_name": null,
                "place_full_name": null,
                "place_country_code": null,
                "max_id": "936329641492611073",
                "since_id": "0",
                "refresh_url": "?since_id=936329641492611073&q=hroggero&result_type=recent&include_entities=1",
                "next_result": null,
                "count": "100",
                "completed_in": "0.086",
                "since_id_str": "0",
                "query": "hroggero",
                "max_id_str": "936329641492611073"
            }]
    },
        "error": {
            "errorCode": 0,
            "errorMsg": ""
        }
    }

Sample Code

This example shows you how to tweet using C#.
The HTTP response contains the result in the form of a JSON payload.


using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace Sample { class Program { static void Main(string[] args) { string url = "https://ENZO_URI:ENZO_PORT/bsc/twitter/poststatus"; string authId = "YOUR_AUTH_ID"; WebRequest wr = WebRequest.CreateHttp(url); try { // Add the required HTTP headers for the call wr.Headers.Add("authToken", authId); wr.Headers.Add("status", "Tweeting is fun!"); wr.Headers.Add("_config", "myconfigname"); wr.Method = "POST"; var resp = wr.GetResponse(); // Execute the command using (var stream = resp.GetResponseStream()) { } Console.WriteLine("HTTP Response: " + ((System.Net.HttpWebResponse)(resp)).StatusCode); } catch (Exception ex) { Console.WriteLine("ERROR: Response from " + baseUrl + command + ":" + ex.Message); } Console.ReadKey(); } } }

This example shows you how to tweet using Python.


import sys import urllib import urllib2 import requests enzourl_receiveMsg="https://ENZO_URI:ENZO_PORT/bsc/twitter/poststatus" enzo_guid="YOUR_AUTH_ID" #create the headers this call expects headers={'status':'Tweeting is fun!', 'authToken': enzoguid, '_config': 'myconfigname' } response=requests.post(enzourl_receiveMsg,headers=headers)

This example shows you how to tweet using a raw HTTP command.


POST ENZO_URI:ENZO_PORT/bsc/twitter/poststatus HTTP/1.1 authToken: YOUR_AUTH_TOKEN _config: myconfigname status: Tweeting is fun!

This example shows you how to tweet using C++.


#include "http_client.h" const char enzoAuthId[] = "YOUR_AUTHID"; const char enzoURI[] = "ENZO_URI:ENZO_PORT/bsc/twitter/poststatus"; int main() { // If the public key of the Enzo SSL certificate is needed, please contact support HTTPClient client = HTTPClient(null, HTTP_POST, enzoURI); client.set_header("authToken", enzoAuthId); client.set_header("_config", "myconfigname"); client.set_header("status", "Tweeting is fun!");"); const Http_Response *response = client.send(NULL, 0); if (response != NULL) { // inspect the response here } }