Ask about Ricoh Theta Camera API with java script code

I try to Connect Ricoh Theta Camera with my App and i used java Script

this is help Text in API Documentation :

Shooting with WebAPI v2.1 (OSC ver. 2) If you have THETA V or later based on WebAPI v2.1, you can shoot with the following line, so you can easily try the API. It’s in this format, just change the part of THETAYL00123456 to the serial number of your camera. Since digest authentication is used in CL mode, set the ID and password for CL mode connection with –digest. ID and password can be set with the RICOH THETA smartphone app.

% curl -X POST http://THETAYL00123456.local./osc/commands/execute --data '{"name":"camera.takePicture"}' -H 'content-type: application/json' --digest -u THETAYL00123456:00123456

And my try code is:

async function get(){
const content = {name:'camera.takePicture', parameters:{sessionId:'SID_0001'}};

const response = await fetch('THETAYN10113693.local./osc/commands/execute', {
        method: 'POST', 
        body: JSON.stringify(content),
        headers:{ 'Content-Type': 'application/json' }

    // Get the fetch response as a stream 

const reader = response.body.getReader();

// Async loop the stream
let chunk = await;
while (chunk && !chunk.done) {
    for (let index = 0; index < chunk.value.length; index++) {
         // parse the response in chunks       
    chunk = await;



I want ask about some points:

  • they told me that I must change this THETAYL00123456 to my Camera serial number and this ((THETAYL00123456)) repeated in API Doc twice, So which one should I to change ?
  • Is this code which I wrote is Correct?Does it match to written information in API Doc? if not I hope please Fix it
  • How Can I test the Connection if work or No?

I wish your help and thanks so much


takePicture = function() {
    var args = {
    data: { "name": "camera.takePicture"},
    headers: { "Content-Type": "application/json" }
};"", args, function (data, response) {
    var thetaResponse = document.getElementById('thetaResponse');
    thetaResponse.innerHTML = JSON.stringify(data);