9.2.10. Create Sensor From JSON

Get a sensor object, add ‘ API TEST’ to the name of the sensor object, delete any pre-existing sensor with the new name, then create a new sensor object with the new name

9.2.10.1. Step 1 - Authenticate to the SOAP API via /auth

1
2
3
4
5
6
7
8
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip, deflate",
  "Connection": "keep-alive",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "password": "VGFuaXVtMjAxNSE=",
  "username": "QWRtaW5pc3RyYXRvcg=="
}
  • Response Headers:
1
2
3
4
5
{
  "connection": "keep-alive",
  "content-length": "134",
  "content-type": "text/plain; charset=us-ascii"
}

9.2.10.2. Step 2 - Get the server version via /info.json

1
2
3
4
5
6
7
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip, deflate",
  "Connection": "keep-alive",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
{
  "connection": "keep-alive",
  "content-length": "19291",
  "content-type": "application/json"
}

9.2.10.3. Step 3 - Issue a GetObject to find an object

1
2
3
4
5
6
7
8
9
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip",
  "Connection": "keep-alive",
  "Content-Length": "507",
  "Content-Type": "text/xml; charset=utf-8",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
6
{
  "connection": "keep-alive",
  "content-encoding": "gzip",
  "content-type": "text/xml;charset=UTF-8",
  "transfer-encoding": "chunked"
}

9.2.10.4. Step 4 - Issue a GetObject to find the object to be deleted

1
2
3
4
5
6
7
8
9
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip",
  "Connection": "keep-alive",
  "Content-Length": "523",
  "Content-Type": "text/xml; charset=utf-8",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
6
{
  "connection": "keep-alive",
  "content-encoding": "gzip",
  "content-type": "text/xml;charset=UTF-8",
  "transfer-encoding": "chunked"
}

9.2.10.5. Step 5 - Issue a DeleteObject to delete an object

1
2
3
4
5
6
7
8
9
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip",
  "Connection": "keep-alive",
  "Content-Length": "1793",
  "Content-Type": "text/xml; charset=utf-8",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
6
{
  "connection": "keep-alive",
  "content-encoding": "gzip",
  "content-type": "text/xml;charset=UTF-8",
  "transfer-encoding": "chunked"
}

9.2.10.6. Step 6 - Issue an AddObject to add an object

1
2
3
4
5
6
7
8
9
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip",
  "Connection": "keep-alive",
  "Content-Length": "1809",
  "Content-Type": "text/xml; charset=utf-8",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
{
  "connection": "keep-alive",
  "content-length": "762",
  "content-type": "text/xml;charset=UTF-8"
}

9.2.10.7. Step 7 - Issue a GetObject on the recently added object in order to get the full object

1
2
3
4
5
6
7
8
9
{
  "Accept": "*/*",
  "Accept-Encoding": "gzip",
  "Connection": "keep-alive",
  "Content-Length": "488",
  "Content-Type": "text/xml; charset=utf-8",
  "User-Agent": "python-requests/2.7.0 CPython/2.7.10 Darwin/14.5.0",
  "session": "1-616-2e870e86903255e8cd2e8870adaa1d3c093967722ae49700020aaa6f30576677f269793b7d65b3cdedf6dfa4003e41539ac83c0385c83bf9edef1664194a0117"
}
  • Response Headers:
1
2
3
4
5
6
{
  "connection": "keep-alive",
  "content-encoding": "gzip",
  "content-type": "text/xml;charset=UTF-8",
  "transfer-encoding": "chunked"
}

Footnotes

[1]this file automatically created by BUILD/build_api_examples.py