Data Collection API
The data collection API (DCAPI) allows you to send data to Oracle Infinity from applications or sites that do not have JavaScript enabled.
Note: For more details about this implementation, contact your Oracle Infinity solutions consultant.
The DCAPI is a REST API that uses a POST request to send a JSON message body containing key value pairs over HTTP/S. This provides an alternative to using the Oracle Infinity Tag and allows you to send multiple event bodies in a nested JSON block using GZIP compression. For example, the Oracle Infinity mobile SDKs use DCAPI to batch multiple events into a single compressed payload to reduce transmission time and bandwidth.
You can use the DCAPI to collect data from:
- Internet of things (IoT) devices with embedded computers and WebSocket outputs
- Server-side data collection for web-enabled applications
- Set-top boxes (STBs)
- Test benches in an automated QA lab, such as bench status, test results, runtime, and so on
Constructing a JSON payload
To send data to Oracle Infinity using the DCAPI, your JSON payload must meet the following requirements:
- It must be a valid JSON object. Use JSON validators to check that your payloads are correctly formatted and delimited.
- It can have an optional "static" field. While not required, it is useful to put common key value pairs in the static block.
- If a "static" field is present, it must have at least one valid key value pair. An empty static block is not allowed.
- Each JSON payload must contain an "events" field, which must contain at least one valid event block with at least one valid key value pair. Alternately, it may contain a list of valid events, each of which contains at least one properly JSON formatted key value pair. Empty events and empty or missing event blocks are not allowed.
- Each event must have a time stamp.
-
Send all key : value pairs as string values. E.g. "key" : "value"
The following parameters are required to successfully collect an event:
dcssip
: The domain visited, such as www.example.com (if sent from a website)dcsuri
: The URI stem, which is the portion of a URL that appears after the host and port and precedes the query string. It is typically the requested file or page that a user accessed.wt.dcsvid
identifies an optional unique custom visitor ID you can assign to your visitors in other systems. This is separate and distinct from automatically generated visitor ID parameters sent by the Oracle Infinity Tag. If you do not send a custom value, this parameter will not be present on the hit.wt.ets
indicates the Unix time stamp for the event measured in milliseconds.wt.dl
specifies a numeric identifier for the kind of event tracked, which are used for event-level filtering and reporting.wt.co_f
is a random value used as a visitor ID and stored in a first-party cookie.
You can also send a variety of optional parameters for each event.
The following example JSON payload shows a simplified format with two events that share the same visitor ID (wt.co_f
): a simulated page view and a subscription click.
{
"static": {
"wt.co_f": "d19aabf1-f402-4854-b890-be077afa1b89"
},
"events": [{
"dcsuri": "\/some\/page.html",
"wt.dl": "0",
"wt.ets": "1523448732",
"wt.ti": "page_title",
"wt.ev": "Event Type"
},
{
"dcsuri": "\/some\/subscribe.js",
"wt.dl": "1",
"wt.ets": "1523448750",
"wt.ti": "Signup Click",
"wt.ev": "Click"
}
]
};
Some of its sample values are for required parameters and a few optional parameters were also included. For descriptions of the possible parameters that can be passed to data collection see the parameter reference.
Example JSON payload from a mobile SDK event:
{
"static": {
"wt.a_nm": "WTBank",
"wt.ct": "WiFi",
"wt.dm": "SAMSUNG SM-J200M",
"wt.ul": "English",
"wt.d_id": "e205fd59dd7636ff",
"wt.a_dc": "T-Mobile",
"wt.g_co": "us",
"wt.co": "yes",
"wt.co_f": "d19aabf1-f402-4854-b890-be077afa1b89"
},
"events": [{
"wt.a_an": "loginBtn",
"wt.sys": "adclick",
"dcsuri": "\/ad\/click",
"wt.dl": "60",
"wt.ets": "1523448732",
"wt.ti": "Sign-in button tapped!",
"wt.a_ac": "1",
"wt.ev": "Tap Event",
"wt.pi": "Sign-in button tapped!"
},
{
"wt.sys": "pause",
"dcsuri": "\/activity\/pause",
"wt.pi": "LoginActivity",
"wt.dl": "61",
"wt.ets": "1523448750",
"wt.ti": "LoginActivity"
}
]
};
Example JavaScript request
The following JavaScript sample for sending events in a simple JSON datga structure to the Oracle Infinity data collection servers does not use GZIP compression:
var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance
var url = "https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true"
// where abc1234567 is your account GUID and dcsverbose=true enables the debug info
var payload = {
"static": {
"wt.a_nm": "WTBank",
"wt.ct": "WiFi",
"wt.dm": "SAMSUNG SM-J200M",
"wt.ul": "English",
"wt.d_id": "e205fd59dd7636ff",
"wt.a_dc": "T-Mobile",
"wt.g_co": "us",
"wt.co": "yes",
"wt.co_f": "d19aabf1-f402-4854-b890-be077afa1b89"
},
"events": [{
"wt.a_an": "loginBtn",
"wt.sys": "adclick",
"dcsuri": "\/ad\/click",
"wt.dl": "60",
"wt.ets": "1523448732",
"wt.ti": "Sign-in button tapped!",
"wt.a_ac": "1",
"wt.ev": "Tap Event",
"wt.pi": "Sign-in button tapped!"
},
{
"wt.sys": "pause",
"dcsuri": "\/activity\/pause",
"wt.pi": "LoginActivity",
"wt.dl": "61",
"wt.ets": "1523448750",
"wt.ti": "LoginActivity"
}
]
};
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
window.console.log("post was successful, reponce was " + this.response);
} else if (this.readyState == 4 && this.status != 200) {
window.console.log("post was not successful, reponce was " + this.response);
}
};
xmlhttp.open("POST", url);
xmlhttp.setRequestHeader("Content-Type", "application/json");
xmlhttp.send(JSON.stringify(payload));
Example request using Java
This is an example implemented in Java for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The Apache HttpComponents library is used to send the HTTP request. The Oracle Infinity data collection also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the Apache HttpComponents library is one of many that can be used for that purpose.
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.EntityBuilder;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.protocol.HTTP;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
public class OracleDataCollection {
private static final String ORA_CLIENT_TIME = "ORA-Client-Time";
private static final String ACCEPT = "Accept";
private static final String PAYLOAD = "{\"static\": {\n" +
"\"wt.a_nm\": \"WTBank\",\n" +
" \"wt.ct\": \"WiFi\",\n" +
" \"wt.dm\": \"SAMSUNG SM-J200M\",\n" +
" \"wt.ul\": \"English\",\n" +
" \"wt.d_id\": \"e205fd59dd7636ff\",\n" +
" \"wt.a_dc\": \"T-Mobile\",\n" +
" \"wt.g_co\": \"us\",\n" +
" \"wt.co\": \"yes\",\n" +
" \"wt.co_f\": \"d19aabf1-f402-4854-b890-be077afa1b89\"\n" +
" },\n" +
" \"events\": [\n" +
" {\n" +
" \t\"wt.a_an\": \"loginBtn\",\n" +
" \"wt.sys\": \"adclick\",\n" +
" \"dcsuri\": \"\\/ad\\/click\",\n" +
" \"wt.dl\": \"60\",\n" +
" \"wt.ets\": \"1510275547878\",\n" +
" \"wt.ti\": \"Sign-in button tapped!\",\n" +
" \"wt.a_ac\": \"1\",\n" +
" \"wt.ev\": \"Tap Event\",\n" +
" \"wt.pi\": \"Sign-in button tapped!\"\n },\n" +
" {\n" +
" \"wt.sys\": \"pause\",\n" +
" \"dcsuri\": \"\\/activity\\/pause\",\n" +
" \"wt.pi\": \"LoginActivity\",\n" +
" \"wt.dl\": \"61\",\n" +
" \"wt.ets\": \"1510275547880\",\n" +
" \"wt.ti\": \"LoginActivity\"\n" +
" } ]\n" +
"};";
public static void main(String[] args) throws Exception {
String url = "https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true"
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
String response = post(url);
System.out.println("Response: " + response);
}
private static String post(final String url) {
final HttpClient client = HttpClientBuilder.create().build();
final StringBuilder result = new StringBuilder();
final HttpPost post = new HttpPost(url);
HttpResponse response;
try {
HttpEntity entity = EntityBuilder.create()
.setText(PAYLOAD)
.setContentType(ContentType.APPLICATION_JSON)
.build();
post.setEntity(entity);
post.setHeader(HTTP.CONTENT_TYPE, "application/json");
post.setHeader(HTTP.USER_AGENT, "My User Agent");
post.setHeader(ACCEPT, "*/*");
post.setHeader(ORA_CLIENT_TIME, String.valueOf(new Date().getTime()));
post.setHeader("Connection", "keep-alive");
response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
} catch (IOException e) {
System.out.println("Connection error :" + e.getMessage());
}
return result.toString();
}
}
Example request using Kotlin
This is an example implemented in Kotlin for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The Apache HttpComponents library is used to send the HTTP request. The Oracle Infinity data collection also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the Apache HttpComponents library is one of many that can be used for that purpose.
import org.apache.http.HttpEntity
import org.apache.http.HttpResponse
import org.apache.http.client.HttpClient
import org.apache.http.client.entity.EntityBuilder
import org.apache.http.client.methods.HttpPost
import org.apache.http.entity.ContentType
import org.apache.http.impl.client.HttpClientBuilder
import org.apache.http.protocol.HTTP
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.util.Date
const val ORA_CLIENT_TIME = "ORA-Client-Time"
const val ACCEPT = "Accept"
const val PAYLOAD = "{\"static\": {\n" +
"\"wt.a_nm\": \"WTBank\",\n" +
" \"wt.ct\": \"WiFi\",\n" +
" \"wt.dm\": \"SAMSUNG SM-J200M\",\n" +
" \"wt.ul\": \"English\",\n" +
" \"wt.d_id\": \"e205fd59dd7636ff\",\n" +
" \"wt.a_dc\": \"T-Mobile\",\n" +
" \"wt.g_co\": \"us\",\n" +
" \"wt.co\": \"yes\",\n" +
" \"wt.co_f\": \"d19aabf1-f402-4854-b890-be077afa1b89\"\n" +
" },\n" +
" \"events\": [\n" +
" {\n" +
" \t\"wt.a_an\": \"loginBtn\",\n" +
" \"wt.sys\": \"adclick\",\n" +
" \"dcsuri\": \"\\/ad\\/click\",\n" +
" \"wt.dl\": \"60\",\n" +
" \"wt.ets\": \"1510275547878\",\n" +
" \"wt.ti\": \"Sign-in button tapped!\",\n" +
" \"wt.a_ac\": \"1\",\n" +
" \"wt.ev\": \"Tap Event\",\n" +
" \"wt.pi\": \"Sign-in button tapped!\"\n },\n" +
" {\n" +
" \"wt.sys\": \"pause\",\n" +
" \"dcsuri\": \"\\/activity\\/pause\",\n" +
" \"wt.pi\": \"LoginActivity\",\n" +
" \"wt.dl\": \"61\",\n" +
" \"wt.ets\": \"1510275547880\",\n" +
" \"wt.ti\": \"LoginActivity\"\n" +
" } ]\n" +
"};"
fun main(args: Array <string> ) {
val url = "https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true"
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
val response = post(url)
println("Response: " + response)
}
private fun post(url: String): String {
val client = HttpClientBuilder.create().build()
val result = StringBuilder()
val post = HttpPost(url)
val response: HttpResponse
try {
val entity = EntityBuilder.create()
.setText(PAYLOAD)
.setContentType(ContentType.APPLICATION_JSON)
.gzipCompress()
.build()
post.entity = entity
post.setHeader(HTTP.CONTENT_TYPE, "application/gzip")
post.setHeader(HTTP.USER_AGENT, "My User Agent")
post.setHeader(ACCEPT, "*/*")
post.setHeader(ORA_CLIENT_TIME, Date().time.toString())
post.setHeader("Connection", "keep-alive")
response = client.execute(post)
val rd = BufferedReader(InputStreamReader(response.getEntity().getContent()))
var line = rd.readLine()
while (line != null) {
result.append(line)
line = rd.readLine()
}
} catch (e: IOException) {
println("Connection error :" + e.message)
}
return result.toString()
}
Example request using Python
This is an example implemented in Python for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The requests and JSON libraries are used to send HTTP requests. The Oracle Infinity data collection also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the zlib library is one of many that can be used for that purpose.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import json
url = 'https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true'
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
headers = {'Content-Type': 'application/json',
'User-agent': 'My Client'}
payload = \
'{"static":{"wt.a_nm": "WTBank", "wt.ct": "WiFi", "wt.dm": "SAMSUNG SM-J200M", "wt.ul": "English", "wt.d_id": "e205fd59dd7636ff", "wt.a_dc": "T-Mobile", "wt.g_co": "us", "wt.co": "yes", "wt.co_f": "d19aabf1-f402-4854-b890-be077afa1b89" },"events": [ { "wt.a_an": "loginBtn", "wt.sys": "adclick", "dcsuri": "\\/ad\\/click", "wt.dl": "60", "wt.ets": "1510275547878", "wt.ti": "Sign-in button tapped!", "wt.a_ac": "1","wt.ev": "Tap Event", "wt.pi": "Sign-in button tapped!" }, { "wt.sys": "pause", "dcsuri": "\\/activity\\/pause", "wt.pi": "LoginActivity", "wt.dl": "61", "wt.ets": "1510275547880", "wt.ti": "LoginActivity" } ] }'
r = requests.post(url, payload, headers=headers)
print r.json()
Example request using C/C++
This is an example implemented in C/C++ for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The curl library is used to send the HTTP request. The Oracle Infinity data collection server also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the zlib library is one of many that can be used for that purpose.
#include < stdio.h > #include < curl / curl.h > #include < string > #include < stdexcept > #include < iostream > #include < iomanip > #include < sstream >
int main(void) {
CURL * curl;
CURLcode res;
std::string payload = "{\"static\": { \"wt.a_nm\": \"WTBank\", \"wt.ct\": \"WiFi\", \"wt.dm\": \"SAMSUNG SM-J200M\", \"wt.ul\": \"English\", \"wt.d_id\": \"e205fd59dd7636ff\", \"wt.a_dc\": \"T-Mobile\", \"wt.g_co\": \"us\", \"wt.co\": \"yes\", \"wt.co_f\": \"d19aabf1-f402-4854-b890-be077afa1b89\"},\"events\": [ { \"wt.a_an\": \"loginBtn\", \"wt.sys\": \"adclick\", \"dcsuri\": \"\\/ad\\/click\", \"wt.dl\": \"60\", \"wt.ets\": \"1510275547878\", \"wt.ti\": \"Sign-in button tapped!\", \"wt.a_ac\": \"1\", \"wt.ev\": \"Tap Event\", \"wt.pi\": \"Sign-in button tapped!\" },{ \"wt.sys\": \"pause\", \"dcsuri\": \"\\/activity\\/pause\", \"wt.pi\": \"LoginActivity\", \"wt.dl\": \"61\", \"wt.ets\": \"1510275547880\", \"wt.ti\": \"LoginActivity\"}]}";
char char_array[data.length()];
std::strcpy(char_array, payload.c_str());
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (curl) {
struct curl_slist * headers = curl_slist_append(headers,
"Content-type: application/json");
curl_easy_setopt(curl, CURLOPT_URL,
"https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true");
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, char_array);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
if (CURLE_OK != res) {
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
}
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
Example request using C#
This is an example implemented in C# for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The System.Net.Http library is used to send the HTTP request. The Oracle Infinity data collection server also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the System.IO.Compression.GZipStream library is one of many that can be used for that purpose.
using System;
using System.Threading.Tasks;
using System.IO;
using System.Net.Http;
using System.Text;
namespace ConsoleApplication1 {
class Program {
static String PAYLOAD = "{\"static\": {" +
"\"wt.a_nm\": \"WTBank\"," +
"\"wt.ct\": \"WiFi\", " +
"\"wt.dm\": \"SAMSUNG SM-J200M\"," +
"\"wt.ul\": \"English\"," +
"\"wt.d_id\": \"e205fd59dd7636ff\"," +
"\"wt.a_dc\": \"T-Mobile\"," +
"\"wt.g_co\": \"us\"," +
"\"wt.co\": \"yes\"," +
"\"wt.co_f\": \"d19aabf1-f402-4854-b890-be077afa1b89\"" +
" }," +
"\"events\": [ " +
"{ " +
"\"wt.a_an\": \"loginBtn\"," +
"\"wt.sys\": \"adclick\"," +
"\"dcsuri\": \"\\/ad\\/click\"," +
"\"wt.dl\": \"60\", " +
"\"wt.ets\": \"1510275547878\"," +
"\"wt.ti\": \"Sign-in button tapped!\"," +
"\"wt.a_ac\": \"1\"," +
"\"wt.ev\": \"Tap Event\", " +
"\"wt.pi\": \"Sign-in button tapped!\" " +
"}," +
"{ " +
"\"wt.sys\": \"pause\", " +
"\"dcsuri\": \"\\/activity\\/pause\"," +
"\"wt.pi\": \"LoginActivity\"," +
"\"wt.dl\": \"61\"," +
"\"wt.ets\": \"1510275547880\"," +
"\"wt.ti\": \"LoginActivity\"" +
" }" +
" ]" +
"}";
static void Main(string[] args) {
post().GetAwaiter().GetResult();
}
static async Task post() {
string text;
try {
byte[] bytData = Encoding.ASCII.GetBytes(PAYLOAD);
using(System.IO.MemoryStream ms = new System.IO.MemoryStream()) {
ms.Read(bytData, 0, bytData.Length);
MemoryStream outStream = new MemoryStream(bytData);
StreamContent streamContent = new StreamContent(outStream);
streamContent.Headers.Add("Content-type", "application/json");
streamContent.Headers.ContentLength = outStream.Length;
Uri target = new Uri("https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true");
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, target);
requestMessage.Content = streamContent;
var client = new HttpClient();
HttpResponseMessage response = await client.SendAsync(requestMessage);
text = await response.Content.ReadAsStringAsync();
}
} catch (Exception ex) {
text = ex.Message;
}
Console.Write("Response: " + text);
}
}
}
Example request using PHP
This is an example implemented in PHP for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The curl library is used to send the HTTP request. The Oracle Infinity data collection server also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the gzencode library is one of many that can be used for that purpose.
$payload = "{\"static\": {\"wt.a_nm\": \"WTBank\", \"wt.ct\": \"WiFi\", \"wt.dm\": \"SAMSUNG SM-J200M\", \"wt.ul\": \"English\", \"wt.d_id\": \"e205fd59dd7636ff\", \"wt.a_dc\": \"T-Mobile\", \"wt.g_co\": \"us\", \"wt.co\": \"yes\", \"wt.co_f\": \"d19aabf1-f402-4854-b890-be077afa1b89\" },\"events\": [ { \"wt.a_an\": \"loginBtn\", \"wt.sys\": \"adclick\", \"dcsuri\": \"\\/ad\\/click\", \"wt.dl\": \"60\", \"wt.ets\": \"1510275547878\", \"wt.ti\": \"Sign-in button tapped!\", \"wt.a_ac\": \"1\", \"wt.ev\": \"Tap Event\", \"wt.pi\": \"Sign-in button tapped!\" }, { \"wt.sys\": \"pause\", \"dcsuri\": \"\\/activity\\/pause\", \"wt.pi\": \"LoginActivity\", \"wt.dl\": \"61\", \"wt.ets\": \"1510275547880\", \"wt.ti\": \"LoginActivity\" } ] }";
$url = "https://dc.oracleinfinity.io/v3/abc1234567?dcsverbose=true";
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
$curl = curl_init($url);
$headers = ['Content-Type: application/json' ,
'User-Agent: My CLient'
];
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl,CURLOPT_POSTFIELDS, $payload);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
echo $response;
curl_close($curl);
Example request using Visual Basic .NET
This is an example implemented in Visual Basic .NET for sending events in a simple JSON data structure to the Oracle Infinity data collection server. The System.Net. library is used to send the HTTP request. The Oracle Infinity data collection server also provides an ability to get gzip-compressed data. If you want to send compressed JSON, the System.IO.Compression.GZipStream library is one of many that can be used for that purpose.
Imports System.Net
Imports System.Text
Imports System.IO
Module Module1
Sub Main()
Dim payload As String = "{""static"": {" +
"""wt.a_nm"": ""WTBank""," +
"""wt.ct"": ""WiFi"", " +
"""wt.dm"": ""SAMSUNG SM-J200M""," +
"""wt.ul"": ""English""," +
"""wt.d_id"": ""e205fd59dd7636ff""," +
"""wt.a_dc"": ""T-Mobile""," +
"""wt.g_co"": ""us""," +
"""wt.co"": ""yes""," +
"""wt.co_f"": ""d19aabf1-f402-4854-b890-be077afa1b89""" +
" }," +
"""events"": [ " +
"{ " +
"""wt.a_an"": ""loginBtn""," +
"""wt.sys"": ""adclick""," +
"""dcsuri"": ""\\/ad\\/click""," +
"""wt.dl"": ""60"", " +
"""wt.ets"": ""1510275547878""," +
"""wt.ti"": ""Sign-in button tapped!""," +
"""wt.a_ac"": ""1""," +
"""wt.ev"": ""Tap Event"", " +
"""wt.pi"": ""Sign-in button tapped!"" " +
"}," +
"{ " +
"""wt.sys"": ""pause"", " +
"""dcsuri"": ""\\/activity\\/pause""," +
"""wt.pi"": ""LoginActivity""," +
"""wt.dl"": ""61""," +
"""wt.ets"": ""1510275547880""," +
"""wt.ti"": ""LoginActivity""" +
" }" +
" ]" +
"}"
Dim url As String = "https://dc.oracleinfinity.io/v3/ abc1234567?dcsverbose=true"
// where abc1234567 is your account guid - dcsverbose=true enables the debug info
Console.WriteLine(post(url, payload).ToString)
End Sub
Function post(ByVal Url As String, ByVal PostData As String) As String
Dim http As HttpWebRequest = WebRequest.Create(Url)
http.ContentType = "application/json"
If Not String.IsNullOrEmpty(PostData) Then
http.Method = "POST"
Dim bytesArray() As Byte = Encoding.ASCII.GetBytes(PostData)
http.ContentLength = bytesArray.Length
Using PostStream As Stream = Http.GetRequestStream()
PostStream.Write(bytesArray, 0, bytesArray.Length)
End Using
End If
Using WebResponse As HttpWebResponse = Http.GetResponse()
Dim responseStream As Stream = WebResponse.GetResponseStream()
Dim reader As StreamReader = New StreamReader(responseStream, Encoding.Default)
Dim html As String = reader.ReadToEnd()
responseStream.Close()
Return html
End Using
End Function
End Module
POSTing a JSON payload
Once you create a valid JSON payload, use your account GUID to POST it to the following DCAPI endpoint:
https://dc.oracleinfinity.io/v3/account_GUID
Legacy implementations must be migrated to v3. Oracle Infinity no longer supports v1 or v2. Account GUID replaces dcsid
as an identifier.
Tip: To receive debug messages, append dcsverbose=true
to the URL. The following sample response would indicate a successful POST:
HTTP/1.0 200 OK Connection: close Content-Type: text/xml Content-Length: 514
<?xml version="1.0" encoding="UTF-8"?>
<fields>
<date>2018-04-11</date>
<time>23:56:04</time>
<c-ip>10.62.81.60</c-ip>
<cs-username>-</cs-username>
<cs-host>-</cs-host>
<cs-method>POST</cs-method>
<cs-uri-stem>/Home</cs-uri-stem>
<cs-uri-query>wt.ti=My%20Home%20Page&wt.tz=-8&wt.cg=My%20Content%20Group&customparam=customval</cs-uri-query>
<sc-status>200</sc-status>
<sc-bytes>-</sc-bytes>
<cs-version>-</cs-version>
<cs-user-agent>My%20Client</cs-user-agent>
<cs-cookie>-</cs-cookie>
<cs-referer>-</cs-referer>
<dcs-id>abc1234567</dcs-id>
</fields>
Parameter Syntax - Syntax for parameter names and values.
Full Parameter Reference - Full reference of all available parameters.