Skip to content

Instantly share code, notes, and snippets.

@ConnorDoyle
Created May 27, 2014 21:46
Show Gist options
  • Save ConnorDoyle/1c074f527fccd33d5fee to your computer and use it in GitHub Desktop.
Save ConnorDoyle/1c074f527fccd33d5fee to your computer and use it in GitHub Desktop.
ServiceNet Session
$ http DELETE localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 2
Server: Jetty(8.1.13.v20130916)
OK
$ http GET localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 52
Content-Type: application/json
Server: Jetty(8.1.13.v20130916)
{
"dns": [],
"interfaces": [],
"natFans": [],
"tunnels": []
}
$ http -v PATCH localhost:9000/doc < examples/diff.json
PATCH /doc HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 1016
Content-Type: application/json; charset=utf-8
Host: localhost:9000
User-Agent: HTTPie/0.8.0
[
{
"op": "add",
"path": "interfaces",
"value": {
"addrs": [
"fc75:0:0:0:0:9fb2:0:804"
],
"name": "my-service"
}
},
{
"op": "remove",
"path": "interfaces",
"value": "my-service"
},
{
"op": "add",
"path": "dns",
"value": {
"addrs": [
"fc75:0:0:0:0:9fb2:0:804"
],
"label": "foo.bar",
"localize": false
}
},
{
"op": "remove",
"path": "dns",
"value": "foo.bar"
},
{
"op": "add",
"path": "natFans",
"value": {
"endpoints": [
"fc75:0:0:0:0:9fb2:0:804",
"fc75:0:0:0:0:9fb2:0:804"
],
"entrypoint": "fc75:0:0:0:0:9fb2:0:804",
"name": "my-nat"
}
},
{
"op": "remove",
"path": "natFans",
"value": "my-nat"
},
{
"op": "add",
"path": "tunnels",
"value": {
"addr": "fc75:0:0:0:0:9fb2:0:804",
"localEnd": "192.168.1.115",
"name": "my-tunnel",
"remoteEnd": "192.168.1.115",
"remoteIPv6Net": "fc75:0:0:0:0:9fb2:0:804/64"
}
},
{
"op": "remove",
"path": "tunnels",
"value": "my-tunnel"
}
]
HTTP/1.1 200 OK
Content-Length: 2
Server: Jetty(8.1.13.v20130916)
OK
$ http GET localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 456
Content-Type: application/json
Server: Jetty(8.1.13.v20130916)
{
"dns": [
{
"addrs": [
"fc75:0:0:0:0:9fb2:0:804"
],
"label": "foo.bar",
"localize": false
}
],
"interfaces": [
{
"addrs": [
"fc75:0:0:0:0:9fb2:0:804"
],
"name": "my-service"
}
],
"natFans": [
{
"endpoints": [
"fc75:0:0:0:0:9fb2:0:804",
"fc75:0:0:0:0:9fb2:0:804"
],
"entrypoint": "fc75:0:0:0:0:9fb2:0:804",
"name": "my-nat"
}
],
"tunnels": [
{
"addr": "fc75:0:0:0:0:9fb2:0:804",
"localEnd": "192.168.1.115",
"name": "my-tunnel",
"remoteEnd": "192.168.1.115",
"remoteIPv6Net": "fc75:0:0:0:0:9fb2:0:804/64"
}
]
}
$ echo '[{ "op": "remove", "path": "interfaces", "value": "my-service" }]' | http -v PATCH localhost:9000/doc
PATCH /doc HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate, compress
Content-Length: 66
Content-Type: application/json; charset=utf-8
Host: localhost:9000
User-Agent: HTTPie/0.8.0
[
{
"op": "remove",
"path": "interfaces",
"value": "my-service"
}
]
HTTP/1.1 200 OK
Content-Length: 2
Server: Jetty(8.1.13.v20130916)
OK
$ http GET localhost:9000/doc
HTTP/1.1 200 OK
Content-Length: 399
Content-Type: application/json
Server: Jetty(8.1.13.v20130916)
{
"dns": [
{
"addrs": [
"fc75:0:0:0:0:9fb2:0:804"
],
"label": "foo.bar",
"localize": false
}
],
"interfaces": [],
"natFans": [
{
"endpoints": [
"fc75:0:0:0:0:9fb2:0:804",
"fc75:0:0:0:0:9fb2:0:804"
],
"entrypoint": "fc75:0:0:0:0:9fb2:0:804",
"name": "my-nat"
}
],
"tunnels": [
{
"addr": "fc75:0:0:0:0:9fb2:0:804",
"localEnd": "192.168.1.115",
"name": "my-tunnel",
"remoteEnd": "192.168.1.115",
"remoteIPv6Net": "fc75:0:0:0:0:9fb2:0:804/64"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment