HTTP Post JSON statement

edited May 2016 in Library Questions

Hi there,

I am relatively new to Processing. What I am trying to do is get processing to send a formated JSON statement to an LRS (Learner registry store). I am using the http.requests library and trying to do a post request.

I thought it would be easy to send the statement like sending it in the body of a normal http post.

import http.requests.*;

PostRequest post = new PostRequest("http:" + "//");
post.addUser("14-******", "****245*******");
post.addHeader("X-Experience-API-Version", "1.0.0");
post.addData("name", "rune");
println("Reponse Content: " + post.getContent());
println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));

Then it returns:
Reponse Content: Error: Invalid or empty statement
Reponse Content-Length Header: 33

the formated statement I am trying to send is

    "actor": {
        "mbox": "",
        "objectType": "Agent"
    "verb": {
        "id": "http://",
        "display": {
            "en-US": "imported"
    "object": {
        "id": "http://",
        "definition": {
            "name": {
                "en-US": "Example Activity"
            "description": {
                "en-US": "Example activity description"
            "type": "http://",
            "interactionType": "other",
            "extensions": "BMI:76, IBI:657,GSR:1800"
        "objectType": "Activity"

Any help would be amazing.

Thanks for your time

Sign In or Register to comment.