Call the THETA Web API using the Linux curl command.
If you use Windows curl.exe, you need to change the '
to "
and "
to \\"
.
When you execute a command, you will gain a better understanding by adding or modifying parameters or setting options by referring to the Web API reference as appropriate.
THETA
followed by a serial number and .OSC
(e.g. THETAYR15104645.OSC
). Connect the PC WiFi to THETA.
The THETA IP address is 192.168.1.1 and the Web API port is 80.Request calling the info protocol:
$ curl [<http://192.168.1.1/osc/info>](<http://192.168.1.1/osc/info>)
Response:
{
"api": [
"/osc/info",
"/osc/state",
"/osc/checkForUpdates",
"/osc/commands/execute",
"/osc/commands/status"
],
"apiLevel": [
2
],
"_bluetoothMacAddress": "58:38:79:78:A2:35",
"endpoints": {
"httpPort": 80,
"httpUpdatesPort": 80
},
"firmwareVersion": "2.30.0",
"gps": true,
"gyro": true,
"manufacturer": "Ricoh Company, Ltd.",
"model": "RICOH THETA X",
"serialNumber": "15104645",
"supportUrl": "<https://theta360.com/en/support/>",
"uptime": 568,
"_wlanMacAddress": "3C:21:9C:F0:39:C1"
}
Set THETA to still image shooting mode and issue the following request. Request to call camera.takePicture command:
$ curl -X POST [<http://192.168.1.1/osc/commands/execute>](<http://192.168.1.1/osc/commands/execute>) --data '{"name":"camera.takePicture"}' -H 'content-type: application/json'
Response to camera.takePicture command:
completion
value represents the progress of image generation (between 0 and 1).id
value to inquire about the progress of image generation.{
"id": "44",
"progress": {
"completion": 0
},
"name": "camera.takePicture",
"state": "inProgress"
}
Request to Commands/Status protocol:
id
value that was included in the response to the camera.takePicture command.$ curl -X POST [<http://192.168.1.1/osc/commands/status>](<http://192.168.1.1/osc/commands/status>) --data '{"id":44}' -H 'content-type: application/json'
Response to Commands/Status protocol:
fileUrl
value is the URL of the generated image file.{
"results": {
"fileUrl": "<http://192.168.1.1/files/100RICOH/R0010144.JPG>"
},
"name": "camera.takePicture",
"state": "done"
}
Request to get an image file:
$ curl [<http://192.168.1.1/files/100RICOH/R0010144.JPG>](<http://192.168.1.1/files/100RICOH/R0010144.JPG>) > tmp.jpg
Request to obtain a thumbnail image file:
?type=thumb
concatenated to the value of fileUrl
.$ curl [<http://192.168.1.1/files/100RICOH/R0010144.JPG?type=thumb>](<http://192.168.1.1/files/100RICOH/R0010144.JPG?type=thumb>) > tmp-thumb.jpg