= NodeODM


[[_overview]]
== Overview
REST API to access ODM


=== Version information
[%hardbreaks]
_Version_ : 2.2.1


=== Contact information
[%hardbreaks]
_Contact_ : Piero Toffanin


=== License information
[%hardbreaks]
_License_ : AGPL-3.0


=== URI scheme
[%hardbreaks]
_BasePath_ : /
_Schemes_ : HTTP


=== Consumes

* `application/json`


=== Produces

* `application/json`
* `application/zip`




[[_paths]]
== Paths

[[_auth_info_get]]
=== GET /auth/info

==== Description
Retrieves login information for this node.


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|LoginInformation|<<_auth_info_get_response_200,Response 200>>
|===

[[_auth_info_get_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*loginUrl* +
_required_|URL (absolute or relative) where to make a POST request to obtain a token, or null if login is disabled.|string
|*message* +
_required_|Message to be displayed to the user prior to login/registration. This might include instructions on how to register or login, or to communicate that authentication is not available.|string
|*registerUrl* +
_required_|URL (absolute or relative) where to make a POST request to register a user, or null if registration is disabled.|string
|===


==== Tags

* auth


[[_auth_login_post]]
=== POST /auth/login

==== Description
Retrieve a token from a username/password pair.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Body*|*password* +
_required_|Password|string|
|*Body*|*username* +
_required_|Username|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Login Succeeded|<<_auth_login_post_response_200,Response 200>>
|*default*|Error|<<_error,Error>>
|===

[[_auth_login_post_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*token* +
_required_|Token to be passed as a query parameter to other API calls.|string
|===


[[_auth_register_post]]
=== POST /auth/register

==== Description
Register a new username/password.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Body*|*password* +
_required_|Password|string|
|*Body*|*username* +
_required_|Username|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Response|<<_response,Response>>
|===


[[_info_get]]
=== GET /info

==== Description
Retrieves information about this node


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Info|<<_info_get_response_200,Response 200>>
|===

[[_info_get_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*availableMemory* +
_optional_|Amount of RAM available in bytes|integer
|*cpuCores* +
_optional_|Number of CPU cores (virtual)|integer
|*engine* +
_required_|Lowercase identifier of processing engine|string
|*engineVersion* +
_required_|Current version of processing engine|string
|*maxImages* +
_required_|Maximum number of images allowed for new tasks or null if there's no limit.|integer
|*maxParallelTasks* +
_optional_|Maximum number of tasks that can be processed simultaneously|integer
|*taskQueueCount* +
_required_|Number of tasks currently being processed or waiting to be processed|integer
|*totalMemory* +
_optional_|Amount of total RAM in the system in bytes|integer
|*version* +
_required_|Current API version|string
|===


==== Tags

* server


[[_options_get]]
=== GET /options

==== Description
Retrieves the command line options that can be passed to process a task


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Options|< <<_option,Option>> > array
|===

[[_option]]
*Option*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*domain* +
_required_|Valid range of values (for example, "positive integer" or "float &gt; 0.0")|string
|*help* +
_required_|Description of what this option does|string
|*name* +
_required_|Command line option (exactly as it is passed to the OpenDroneMap process, minus the leading '–')|string
|*type* +
_required_|Datatype of the value of this option|enum (int, float, string, bool)
|*value* +
_required_|Default value of this option|string
|===


==== Tags

* server


[[_task_cancel_post]]
=== POST /task/cancel

==== Description
Cancels a task (stops its execution, or prevents it from being executed)


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*Body*|*uuid* +
_required_|UUID of the task|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Command Received|<<_response,Response>>
|===


[[_task_list_get]]
=== GET /task/list

==== Description
Gets the list of tasks available on this node.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Task List|< <<_task_list_get_response_200,Response 200>> > array
|*default*|Error|<<_error,Error>>
|===

[[_task_list_get_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*uuid* +
_required_|UUID|string
|===


==== Tags

* task


[[_task_new_post]]
=== POST /task/new

==== Description
Creates a new task and places it at the end of the processing queue. For uploading really large tasks, see /task/new/init instead.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Header*|*set-uuid* +
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*images* +
_optional_|Images to process, plus optional files such as a GEO file (geo.txt), image groups file (image_groups.txt), GCP file (*.txt), seed file (seed.zip) or alignment files (align.las, align.laz, align.tif). If included, the GCP file should have .txt extension. If included, the seed archive pre-polulates the task directory with its contents.|file|
|*FormData*|*name* +
_optional_|An optional name to be associated with the task|string|
|*FormData*|*options* +
_optional_|Serialized JSON string of the options to use for processing, as an array of the format: [{name: option1, value: value1}, {name: option2, value: value2}, …]. For example, [{"name":"cmvs-maxImages","value":"500"},{"name":"time","value":true}]. For a list of all options, call /options|string|
|*FormData*|*outputs* +
_optional_|An optional serialized JSON string of paths relative to the project directory that should be included in the all.zip result file, overriding the default behavior.|string|
|*FormData*|*skipPostProcessing* +
_optional_|When set, skips generation of point cloud tiles.|boolean|
|*FormData*|*webhook* +
_optional_|Optional URL to call when processing has ended (either successfully or unsuccessfully).|string|
|*FormData*|*zipurl* +
_optional_|URL of the zip file containing the images to process, plus an optional GEO file and/or an optional GCP file. If included, the GCP file should have .txt extension|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Success|<<_task_new_post_response_200,Response 200>>
|*default*|Error|<<_error,Error>>
|===

[[_task_new_post_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*uuid* +
_required_|UUID of the newly created task|string
|===


==== Consumes

* `multipart/form-data`


==== Tags

* task


[[_task_new_commit_uuid_post]]
=== POST /task/new/commit/{uuid}

==== Description
Creates a new task for which images have been uploaded via /task/new/upload.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Path*|*uuid* +
_required_|UUID of the task|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Success|<<_task_new_commit_uuid_post_response_200,Response 200>>
|*default*|Error|<<_error,Error>>
|===

[[_task_new_commit_uuid_post_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*uuid* +
_required_|UUID of the newly created task|string
|===


==== Tags

* task


[[_task_new_init_post]]
=== POST /task/new/init

==== Description
Initialize the upload of a new task. If successful, a user can start uploading files via /task/new/upload. The task will not start until /task/new/commit is called.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Header*|*set-uuid* +
_optional_|An optional UUID string that will be used as UUID for this task instead of generating a random one.|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*dateCreated* +
_optional_|An optional timestamp overriding the default creation date of the task.|integer|
|*FormData*|*name* +
_optional_|An optional name to be associated with the task|string|
|*FormData*|*options* +
_optional_|Serialized JSON string of the options to use for processing, as an array of the format: [{name: option1, value: value1}, {name: option2, value: value2}, …]. For example, [{"name":"cmvs-maxImages","value":"500"},{"name":"time","value":true}]. For a list of all options, call /options|string|
|*FormData*|*outputs* +
_optional_|An optional serialized JSON string of paths relative to the project directory that should be included in the all.zip result file, overriding the default behavior.|string|
|*FormData*|*skipPostProcessing* +
_optional_|When set, skips generation of point cloud tiles.|boolean|
|*FormData*|*webhook* +
_optional_|Optional URL to call when processing has ended (either successfully or unsuccessfully).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Success|<<_task_new_init_post_response_200,Response 200>>
|*default*|Error|<<_error,Error>>
|===

[[_task_new_init_post_response_200]]
*Response 200*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*uuid* +
_required_|UUID of the newly created task|string
|===


==== Tags

* task


[[_task_new_upload_uuid_post]]
=== POST /task/new/upload/{uuid}

==== Description
Adds one or more files to the task created via /task/new/init. It does not start the task. To start the task, call /task/new/commit.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Path*|*uuid* +
_required_|UUID of the task|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*FormData*|*images* +
_required_|Images to process, plus optional files such as a GEO file (geo.txt), image groups file (image_groups.txt), GCP file (*.txt), seed file (seed.zip) or alignment files (align.las, align.laz, align.tif). If included, the GCP file should have .txt extension. If included, the seed archive pre-polulates the task directory with its contents.|file|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|File Received|<<_response,Response>>
|*default*|Error|<<_error,Error>>
|===


==== Consumes

* `multipart/form-data`


==== Tags

* task


[[_task_remove_post]]
=== POST /task/remove

==== Description
Removes a task and deletes all of its assets


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*Body*|*uuid* +
_required_|UUID of the task|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Command Received|<<_response,Response>>
|===


[[_task_restart_post]]
=== POST /task/restart

==== Description
Restarts a task that was previously canceled, that had failed to process or that successfully completed


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*Body*|*options* +
_optional_|Serialized JSON string of the options to use for processing, as an array of the format: [{name: option1, value: value1}, {name: option2, value: value2}, …]. For example, [{"name":"cmvs-maxImages","value":"500"},{"name":"time","value":true}]. For a list of all options, call /options. Overrides the previous options set for this task.|string|
|*Body*|*uuid* +
_required_|UUID of the task|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Command Received|<<_response,Response>>
|===


[[_task_uuid_download_asset_get]]
=== GET /task/{uuid}/download/{asset}

==== Description
Retrieves an asset (the output of OpenDroneMap's processing) associated with a task


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Path*|*asset* +
_required_|Type of asset to download. Use "all.zip" for zip file containing all assets.|enum (all.zip)|
|*Path*|*uuid* +
_required_|UUID of the task|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Asset File|file
|*default*|Error message|<<_error,Error>>
|===


==== Produces

* `application/zip`


==== Tags

* task


[[_task_uuid_info_get]]
=== GET /task/{uuid}/info

==== Description
Gets information about this task, such as name, creation date, processing time, status, command line options and number of images being processed. See schema definition for a full list.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Path*|*uuid* +
_required_|UUID of the task|string|
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|*Query*|*with_output* +
_optional_|Optionally retrieve the console output for this task. The parameter specifies the line number that the console output should be truncated from. For example, passing a value of 100 will retrieve the console output starting from line 100. By default no console output is added to the response.|integer|`"0"`
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Task Information|<<_taskinfo,TaskInfo>>
|*default*|Error|<<_error,Error>>
|===

[[_taskinfo]]
*TaskInfo*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*dateCreated* +
_required_|Timestamp|integer
|*imagesCount* +
_required_|Number of images|integer
|*name* +
_required_|Name|string
|*options* +
_required_|List of options used to process this task|< <<_task_uuid_info_get_options,options>> > array
|*output* +
_optional_|Console output for the task (only if requested via ?output=<linenum>)|< string > array
|*processingTime* +
_required_|Milliseconds that have elapsed since the task started being processed.|integer
|*status* +
_required_||<<_task_uuid_info_get_status,status>>
|*uuid* +
_required_|UUID|string
|===

[[_task_uuid_info_get_options]]
*options*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*name* +
_required_|Option name (example: "odm_meshing-octreeDepth")|string
|*value* +
_required_|Value (example: 9)|string
|===

[[_task_uuid_info_get_status]]
*status*

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*code* +
_required_|Status code (10 = QUEUED, 20 = RUNNING, 30 = FAILED, 40 = COMPLETED, 50 = CANCELED)|integer
|===


==== Tags

* task


[[_task_uuid_output_get]]
=== GET /task/{uuid}/output

==== Description
Retrieves the console output of the OpenDroneMap's process. Useful for monitoring execution and to provide updates to the user.


==== Parameters

[options="header", cols=".^2,.^3,.^9,.^4,.^2"]
|===
|Type|Name|Description|Schema|Default
|*Path*|*uuid* +
_required_|UUID of the task|string|
|*Query*|*line* +
_optional_|Optional line number that the console output should be truncated from. For example, passing a value of 100 will retrieve the console output starting from line 100. Defaults to 0 (retrieve all console output).|integer|`"0"`
|*Query*|*token* +
_optional_|Token required for authentication (when authentication is required).|string|
|===


==== Responses

[options="header", cols=".^2,.^14,.^4"]
|===
|HTTP Code|Description|Schema
|*200*|Console Output|string
|*default*|Error|<<_error,Error>>
|===


==== Tags

* task




[[_definitions]]
== Definitions

[[_error]]
=== Error

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*error* +
_required_|Description of the error|string
|===


[[_response]]
=== Response

[options="header", cols=".^3,.^11,.^4"]
|===
|Name|Description|Schema
|*error* +
_optional_|Error message if an error occured|string
|*success* +
_required_|true if the command succeeded, false otherwise|boolean
|===





