Code Samples

cURL

You can use cURL from the terminal to make an HTTP request to the Ingest API. The following example posts a single JSON message to the source and displays the response headers.

curl \
  -H "Content-Type: application/json" \
  -H "Authorization: token 7836e0e6-2937-4ff9-9463-eff988e02de2" \
  -X POST -d '{"testing":"123"}' \
  -i \
  https://listener-ingest-services-demo.ln.uda.io/message

Java

You can use Java to make an HTTP request to the Ingest API. The following example uses the HttpClient package to create a POST request that sends a single JSON message to the source and prints the response object.

StringEntity body = new StringEntity("{\"testing\": \"123\"}");
HttpPost postReq = new HttpPost("https://listener-ingest-services-demo.ln.uda.io/message");
postReq.addHeader("Authorization", "token " + 7836e0e6-2937-4ff9-9463-eff988e02de2);
postReq.setEntity(body);

HttpClient client = new DefaultHttpClient();
HttpResponse resp = client.execute(postReq);

Python

You can use Python to make an HTTP request to the Ingest API. The following example uses the requests package to create a POST request that sends a single JSON message to the source and prints the response object.

import urllib2

req = urllib2.Request("https://listener-ingest-services-demo.ln.uda.io/message", data='''{"testing": "123"}''', headers={"Authorization": "token 7836e0e6-2937-4ff9-9463-eff988e02de2"})
f = urllib2.urlopen(req)

results matching ""

    No results matching ""