Nodejs new task exmaple


Hello guys. Can you help me with my problem?

I want to create new tasks in WebODM from nodejs server. So i have urls with images, i download them into my nodejs server and then create POST request to webodm api. And it returns only “Bad request”. And I don’t even know how to figure out it, how to debug django framework API or something else, cause i’m not a python developer.

Maybe if somebody can provide some example, how to upload images from nodejs server, it helps me

Thank you.


Hey @shoudaos :hand: see if this helps.

It’s an example of upload to the NodeODM API, but should work similarly (although not identically) for the WebODM API.


This may also help as it documents a bit of the WebODM API, albeit with python examples:


Thank you for this reference. But I want to ask if you know maybe what is wrong with my code?
For making requests I use “request” lib for nodejs.
Here it is:

    const request = require("request");

    let requestSettings = {
        method: "GET"

    let promises = [];
    // Here I download images from urls:
    // => {
        requestSettings.url = "http:" + image;
        promises.push(new Promise((resolve, reject) => {
            request(requestSettings, function (error, response, data) {
                if (error) {
                if (response.statusCode !== 200) {
                    reject("Invalid status code <" + response.statusCode + ">");

    Promise.all(promises).then(images => {
        startTask(projectId, images);

    // Here I'm preparing the new task:
function startTask(projectId, images) {
    const opts = {
        url: `http://${hostname}:${port}/api/projects/${projectId}/tasks/`,
        method: "POST",
        json: true,
        formData: {
            // Here I just hardcoded the data for testing
            "images[0]": images[0],
            "images[1]": images[1],
            "images[2]": images[2],
            "name": "Task of 2019 - 01 - 21T13: 12:43.474Z",
            "processing_node": "1",
            "auto_processing_node": "true",
            "resize_to": "2048",
            "options[name]": "dsm",
            "options[value]": "true"
        headers: {
            "Authorization": `JWT ${process.env.ODM_TOKEN}`
    request(opts, (err, httpResponse, body) => {
        console.log(err, httpResponse, body);

So the response comes with status 400: Bad Request