200 OK response - Probably incorrect payload - Empty response

Resolved.
You have to make an array of the args and then stringify the array
If anyone encouters the same issue since It’s not documented (There are only examples using NPM packages that handle this for you) there you go with a sample :

if (geometry instanceof rhino.Brep) {
            let args = [geometry];

            // Send a request to the Rhino Compute server to compute the volume
            fetch('http://123.123.123.123/rhino/geometry/brep/getvolume-brep', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'RhinoApiToken': '123x123',
                    'User-Agent': `compute.rhino3d.js/0.11.0`
                },
                body: JSON.stringify(args) // Send the argument list in the request body
            }).then(response => response.json()).then(data => {
                // Get the volume from the response
                let volume = data[0].Volume; // Access the volume from the first item in the response array
                console.log("Calculated volume: " + volume);
                totalVolume += volume;
            }).catch(error => {
                console.error("Error occurred while calculating volume: " + error);
            });
        } else {
            console.log("Geometry is not a Brep, skipping volume calculation");
        }
1 Like