Skip to content

HTTP POST requests

Ruben Taelman edited this page Oct 19, 2021 · 7 revisions

HTTP Proxy blocks are accessible via HTTP and allow HTTP POST requests to update their value. (HTTP Proxies conform to the Linked Data Notifications specification)

A certain value type must be selected in the HTTP Proxy, and only requests of that type will be accepted.

This document shows example POST requests for all possible value types. For the examples, we will use the curl command, which is installed by default on most UNIX systems.

The following examples assume a HTTP Proxy with ID 7 to exist (http://localhost:3000/networkElement/integratedrest/http/7)

Boolean

curl -X POST -d '{ "value": true }' http://localhost:3000/networkElement/integratedrest/http/7

Integer

curl -X POST -d '{ "value": 123 }' http://localhost:3000/networkElement/integratedrest/http/7

Double

curl -X POST -d '{ "value": { "@type": "http://www.w3.org/2001/XMLSchema#decimal", "@value": "123.5" } }' http://localhost:3000/networkElement/integratedrest/http/7

Long

curl -X POST -d '{ "value": { "@type": "http://www.w3.org/2001/XMLSchema#long", "@value": "9223372036775807" } }' http://localhost:3000/networkElement/integratedrest/http/7

String

curl -X POST -d '{ "value": "This is a string" }' http://localhost:3000/networkElement/integratedrest/http/7

Block

Meta is optional.

curl -X POST -d '{ "value": { "@type": "ValueBlock", "resourceLocation": "minecraft:sandstone", "meta": 0 } }' http://localhost:3000/networkElement/integratedrest/http/7

Item

Count, meta and nbt are optional.

curl -X POST -d '{ "value": { "@type": "ValueItem", "resourceLocation": "integrateddynamics:wrench", "count": 2, "meta": 0, "nbt": { "key": "value" } } }' http://localhost:3000/networkElement/integratedrest/http/7

NBT

curl -X POST -d '{ "value": { "@type": "ValueNbt", "nbt": { "a": "b", "c": "1b" } } }' http://localhost:3000/networkElement/integratedrest/http/7

Fluid

Count and nbt are optional.

curl -X POST -d '{ "value": { "@type": "ValueFluid", "fluidName": "lava", "count": 1000, "nbt": { "key": "value" } } }' http://localhost:3000/networkElement/integratedrest/http/7

List

curl -X POST -d '{ "value": [0, 1, 2] }' http://localhost:3000/networkElement/integratedrest/http/7
curl -X POST -d '{ "value": [{ "@type": "ValueFluid", "fluidName": "lava", "count": 10 }, { "@type": "ValueFluid", "fluidName": "water", "count": 20 }] }' http://localhost:3000/networkElement/integratedrest/http/7
Clone this wiki locally