From a88fb62c615faf06a169d65a44d4da913a70f226 Mon Sep 17 00:00:00 2001 From: Jeffrey Smith II Date: Wed, 25 Jan 2023 10:29:52 -0500 Subject: [PATCH 1/2] Revert "refactor: common task properties: (#591)" This reverts commit 83a4f8e197b806e6d8e0a64587c3d7bbecf83736 --- contracts/cloud-diff.yml | 585 ++++++++------- contracts/cloud.json | 375 +++++----- contracts/cloud.yml | 674 ++++++++--------- contracts/common.yml | 229 ++---- contracts/oss-diff.yml | 300 ++++---- contracts/oss.json | 302 ++++---- contracts/oss.yml | 419 ++++------- contracts/ref/cloud.yml | 702 +++++++++--------- contracts/ref/oss.yml | 440 +++++------ src/cloud.yml | 8 +- src/cloud/paths/tasks.yml | 172 +++-- src/cloud/paths/tasks_taskID.yml | 94 ++- .../examples/TaskRequestExamples.yml | 17 - src/cloud/schemas/Task.yml | 141 +++- src/cloud/schemas/TaskCreateRequest.yml | 81 +- src/cloud/schemas/TaskProperties.yml | 26 - src/cloud/schemas/TaskUpdateRequest.yml | 30 +- src/common/_schemas.yml | 16 - src/common/paths/tasks.yml | 76 +- src/common/paths/tasks_taskID.yml | 41 +- src/common/paths/tasks_taskID_labels.yml | 27 +- .../paths/tasks_taskID_labels_labelID.yml | 10 +- src/common/paths/tasks_taskID_logs.yml | 21 +- src/common/paths/tasks_taskID_members.yml | 25 +- .../paths/tasks_taskID_members_userID.yml | 10 +- src/common/paths/tasks_taskID_owners.yml | 14 +- .../paths/tasks_taskID_owners_userID.yml | 9 +- src/common/paths/tasks_taskID_runs.yml | 37 +- src/common/paths/tasks_taskID_runs_runID.yml | 20 +- .../paths/tasks_taskID_runs_runID_logs.yml | 10 +- .../paths/tasks_taskID_runs_runID_retry.yml | 12 +- .../examples/AuthorizationRequestExamples.yml | 84 +-- .../examples/TaskRequestExamples.yml | 34 +- src/common/schemas/Task.yml | 112 ++- src/common/schemas/TaskCreateRequest.yml | 24 +- src/common/schemas/TaskProperties.yml | 118 --- src/common/schemas/TaskUpdateRequest.yml | 20 +- src/oss.yml | 2 +- 38 files changed, 2529 insertions(+), 2788 deletions(-) delete mode 100644 src/cloud/requestBody/examples/TaskRequestExamples.yml delete mode 100644 src/cloud/schemas/TaskProperties.yml delete mode 100644 src/common/schemas/TaskProperties.yml diff --git a/contracts/cloud-diff.yml b/contracts/cloud-diff.yml index 731f7e2af..3000c647a 100644 --- a/contracts/cloud-diff.yml +++ b/contracts/cloud-diff.yml @@ -1113,20 +1113,17 @@ paths: org: /api/v2/labels/1 properties: self: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' cells: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: - type: string - format: uri - readOnly: true - description: URI of resource. + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -1169,7 +1166,7 @@ paths: type: string description: The reference to a view from the views API. labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' - type: object allOf: - $ref: '#/paths/~1dashboards/post/requestBody/content/application~1json/schema' @@ -1186,17 +1183,17 @@ paths: org: /api/v2/labels/1 properties: self: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' cells: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -1934,7 +1931,7 @@ paths: readOnly: true type: string labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' links: type: object readOnly: true @@ -1947,19 +1944,19 @@ paths: properties: self: description: The URL for this check. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: description: The URL to retrieve labels for this check. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: description: The URL to retrieve members for this check. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: description: The URL to retrieve owners for this check. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' query: description: The URL to retrieve the Flux script for this check. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' required: - name - orgID @@ -2778,7 +2775,7 @@ paths: items: $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/1/allOf/1/properties/cells/items/allOf/1/properties/properties/oneOf/0/properties/colors/items' labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' default: description: Unexpected error content: @@ -2880,11 +2877,11 @@ paths: URI pointers for additional paged results. properties: next: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' self: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' prev: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' required: - self dashboards: @@ -2903,23 +2900,19 @@ paths: tags: - Data I/O endpoints - Tasks - summary: List tasks + summary: List all tasks description: | - Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. - - #### Related guide - - - [Process data with InfluxDB tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/) parameters: - $ref: '#/paths/~1users/get/parameters/0' - in: query name: name description: | - A task name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) with the specified name. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -2928,29 +2921,29 @@ paths: schema: type: string description: | - A task ID. - Only returns [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -2959,8 +2952,8 @@ paths: - active - inactive description: | - A task status. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -2993,11 +2986,8 @@ paths: - in: query name: sortBy description: | - The sort field. - Specifies the task property used to sort records in the list. - Default is `name`. - - The parameter has one supported value: `name`. + The sort field. Only `name` is supported. + Specifies the field used to sort records in the list. required: false schema: type: string @@ -3006,13 +2996,11 @@ paths: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`). Default is `system`. - + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. - To reduce the response size, set the `type` parameter to `basic` (`type=basic`) - to omit some task properties (`flux`, `createdAt`, `updatedAt`). + To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false schema: default: '' @@ -3023,8 +3011,8 @@ paths: - in: query name: scriptID description: | - A script ID. - Only returns tasks that use the specified [invokable script](#tag/Invokable-Scripts). + A [script](#tag/Invokable-Scripts) ID. + Only returns tasks that use the specified invokable script. schema: type: string responses: @@ -3153,7 +3141,52 @@ paths: description: | Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. - Use this endpoint to create a scheduled task that runs a script. + Use this endpoint to create a scheduled task that runs a Flux script. + + #### InfluxDB Cloud + + - You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -3164,41 +3197,15 @@ paths: parameters: - $ref: '#/paths/~1users/get/parameters/0' requestBody: - description: | - In the request body, provide the task. - - Set one of the following properties to provide the script that the task runs: - - `flux` - - `scriptID` - - If you set the `scriptID` property, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, you must provide the `task` configuration option - in the Flux script. - - See [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't use `flux` and `scriptID` in the same task. + description: The task to create required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' responses: '201': - description: Success. The response body contains a `tasks` list with the task. + description: Success. The response body contains a `tasks` list with the new task. content: application/json: schema: @@ -3210,10 +3217,8 @@ paths: #### InfluxDB Cloud - - Returns this error if the task doesn't contain the `flux` property - or the `scriptID` property. - - Returns this error if the task contains `flux` _and_ `scriptID` - properties. + - Returns this error if the task doesn't contain one of _`flux`_ or _`scriptID`_. + - Returns this error if the task contains _`flux`_ _and_ _`scriptID`_. content: application/json: schema: @@ -3239,6 +3244,44 @@ paths: application/json: schema: $ref: '#/paths/~1users/get/responses/401/content/application~1json/schema' + x-codeSamples: + - lang: Shell + label: 'cURL: create a Flux script task' + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF + - lang: Shell + label: 'cURL: create a Flux script reference task' + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "scriptID": "085138a111448000", + "scriptParameters": + { + "rangeStart": "-30d", + "bucket": "air_sensor", + "filterField": "temperature", + "groupColumn": "_time" + } + } + EOF '/tasks/{taskID}': get: operationId: GetTasksID @@ -3247,7 +3290,7 @@ paths: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). parameters: - $ref: '#/paths/~1users/get/parameters/0' - in: path @@ -3256,8 +3299,8 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Specifies the task to retrieve. responses: '200': description: Success. The response body contains the task. @@ -3325,52 +3368,67 @@ paths: - Tasks summary: Update a task description: | - Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), + Updates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. + To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. - The `status` property set to `inactive` cancels scheduled runs and prevents manual runs of the task. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. - #### Related guides + #### InfluxDB Cloud - - [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/) - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) + - Use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. requestBody: - description: | - In the request body, provide the task properties to update. - To provide the script that the task runs, - set either the `flux` property or the `scriptID` property. - - If you set `scriptID`, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, provide the `task` configuration option - in the Flux script. - - See [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't set `flux` and `scriptID` properties for the same task--for - example, if you set the `scriptID` property, then InfluxDB sets the `flux` property - to an empty string (`""`). + description: An task update to apply. required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' parameters: - $ref: '#/paths/~1users/get/parameters/0' - in: path @@ -3379,8 +3437,8 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to update. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Specifies the task to update. responses: '200': description: Success. The response body contains the updated task. @@ -3404,13 +3462,12 @@ paths: - Tasks summary: Delete a task description: | - Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task's `status` - property to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: '#/paths/~1users/get/parameters/0' - in: path @@ -3418,9 +3475,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete. + description: 'A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to delete.' responses: '204': description: Success. The task and task runs are deleted. Scheduled runs are canceled. @@ -3545,21 +3600,21 @@ components: dashboards: /api/v2/dashboards?org=myorg properties: self: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' secrets: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' buckets: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' tasks: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' dashboards: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -3605,22 +3660,22 @@ components: properties: labels: description: The URL to retrieve labels for this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: description: The URL to retrieve members that can read this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: description: The URL to retrieve parent organization for this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: description: The URL to retrieve owners that can read and write to this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' self: description: The URL for this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' write: description: The URL to write line protocol to this bucket. - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -3702,7 +3757,7 @@ components: required: - everySeconds labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' required: - name - retentionRules @@ -3852,10 +3907,10 @@ components: properties: self: readOnly: true - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' user: readOnly: true - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' Limit: type: object description: These are org limits similar to those configured in/by quartz. @@ -3999,28 +4054,7 @@ components: sort_order: type: integer labels: - type: array - items: - type: object - properties: - id: - readOnly: true - type: string - orgID: - readOnly: true - type: string - name: - type: string - properties: - type: object - additionalProperties: - type: string - description: | - Key-value pairs associated with this label. - To remove a property, send an update with an empty value (`""`) for the key. - example: - color: ffb3b3 - description: this is a description + $ref: '#/components/schemas/Task/properties/labels' arguments: type: object oneOf: @@ -4292,33 +4326,31 @@ components: id: readOnly: true type: string - description: | - The resource ID that InfluxDB uses to uniquely identify the task. orgID: description: | - An organization ID. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Specifies the organization that owns the task. type: string org: description: | - An organization name. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Specifies the organization that owns the task. type: string name: description: The name of the task. type: string - description: - description: A description of the task. - type: string ownerID: description: | - A user ID. - Identifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the task. + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string + description: + description: A description of the task. + type: string status: type: string enum: @@ -4327,11 +4359,32 @@ components: description: | `inactive` cancels scheduled runs and prevents manual runs of the task. labels: - $ref: '#/components/schemas/Variable/properties/labels' + type: array + items: + type: object + properties: + id: + readOnly: true + type: string + orgID: + readOnly: true + type: string + name: + type: string + properties: + type: object + additionalProperties: + type: string + description: | + Key-value pairs associated with this label. + To remove a property, send an update with an empty value (`""`) for the key. + example: + color: ffb3b3 + description: this is a description authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to @@ -4339,14 +4392,12 @@ components: type: string flux: description: | - Flux with [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - and the script for the task to run. + The Flux script that the task executes. - #### Related guides - - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) + #### Limitations + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. type: string - format: Flux + format: flux every: description: 'The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' type: string @@ -4354,7 +4405,6 @@ components: cron: description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' type: string - format: cron offset: description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' type: string @@ -4394,21 +4444,45 @@ components: logs: /api/v2/tasks/1/logs properties: self: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + type: string + format: uri + readOnly: true + description: URI of resource. owners: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' runs: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' logs: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/0/allOf/1/properties/links/properties/org' + $ref: '#/components/schemas/Task/properties/links/properties/self' scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: | + A script ID. + Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes. + + #### Limitations + + - If you use the `scriptID` property, you can't use the `flux` property. + + #### Related guides + + - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: | + Key-value pairs for `params` in the script. + Defines the invocation parameter values passed to the script specified by `scriptID`. + When running the task, InfluxDB executes the script with the parameters + you provide. + + #### Limitations + + - To use `scriptParameters`, you must provide a `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object required: - id - name @@ -4417,74 +4491,85 @@ components: type: object properties: orgID: - $ref: '#/components/schemas/Task/properties/orgID' + description: The ID of the organization that owns the task. + type: string org: - $ref: '#/components/schemas/Task/properties/org' - name: - $ref: '#/components/schemas/Task/properties/name' - description: - $ref: '#/components/schemas/Task/properties/description' - every: - $ref: '#/components/schemas/Task/properties/every' - cron: - $ref: '#/components/schemas/Task/properties/cron' - offset: - $ref: '#/components/schemas/Task/properties/offset' + description: The name of the organization that owns the task. + type: string status: $ref: '#/components/schemas/Task/properties/status' flux: - $ref: '#/components/schemas/Task/properties/flux' - scriptID: - $ref: '#/components/schemas/TaskScriptID' - scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' - TaskScriptID: - description: | - A script ID. - Identifies the [invokable script](#tag/Invokable-Scripts) that the task runs. + description: | + The Flux script that the task runs. - #### Related guides + #### Limitations - - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: string - TaskScriptParameters: - description: | - Key-value pairs for `params` in the script. - Defines the invocation parameter values passed to the [invokable script](#tag/Invokable-Scripts) specified - by the `scriptID` property. - When running the task, InfluxDB executes the script with the parameters - you provide. + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string + description: + description: The description of the task. + type: string + scriptID: + description: | + The ID of the script that the task runs. - #### Limitations + #### Limitations - - To use the `scriptParameters` property, you must also set the `scriptID` property - for the task. + - If you use the `scriptID` property, you can't use the `flux` property. + type: string + scriptParameters: + description: | + The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run. - #### Related guides + #### Limitations - - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: object + - `scriptParameters` requires `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object + name: + description: The name of the task + type: string + every: + description: | + The interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string + cron: + description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.' + type: string + offset: + description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' + type: string + format: duration TaskUpdateRequest: type: object properties: status: $ref: '#/components/schemas/Task/properties/status' + flux: + description: Update the Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/Task/properties/name' - description: - $ref: '#/components/schemas/Task/properties/description' + description: Update the 'name' option in the flux script. + type: string every: - $ref: '#/components/schemas/Task/properties/every' + description: Update the 'every' option in the flux script. + type: string cron: - $ref: '#/components/schemas/Task/properties/cron' + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: '#/components/schemas/Task/properties/offset' - flux: - $ref: '#/components/schemas/Task/properties/flux' + description: Update the 'offset' option in the flux script. + type: string + description: + description: Update the description of the task. + type: string scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: Update the 'scriptID' of the task. + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: Update the 'scriptParameters' of the task. + type: object responses: null examples: AuthorizationPostRequest: @@ -4524,7 +4609,7 @@ components: summary: A task with Flux description: Sets the `flux` property with Flux task options and a query. value: - flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. TaskWithScriptRequest: diff --git a/contracts/cloud.json b/contracts/cloud.json index a1588ca09..53c71b2e4 100644 --- a/contracts/cloud.json +++ b/contracts/cloud.json @@ -8437,7 +8437,7 @@ "Tasks" ], "summary": "List runs for a task", - "description": "Lists runs for the specified [task]({{% INFLUXDB_DOCS_URL %}}/process-data/).\n\nTo limit which task runs are returned, pass query parameters in your request.\nIf you don't pass query parameters, InfluxDB returns all runs for the task\nup to the default `limit`.\n", + "description": "Retrieves a list of runs for a [task]({{% INFLUXDB_DOCS_URL %}}/process-data/).\n\nTo limit which task runs are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all task runs up to the default `limit`.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8449,7 +8449,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto list runs for.\n" + "description": "The ID of the task to get runs for.\nOnly returns runs for this task.\n" }, { "in": "query", @@ -8457,7 +8457,7 @@ "schema": { "type": "string" }, - "description": "A task run ID. Only returns runs created after the specified run." + "description": "A task run ID. Only returns runs created after this run." }, { "in": "query", @@ -8477,7 +8477,7 @@ "type": "string", "format": "date-time" }, - "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled after the specified time.\n" + "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled after this time.\n" }, { "in": "query", @@ -8486,7 +8486,7 @@ "type": "string", "format": "date-time" }, - "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled before the specified time.\n" + "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled before this time.\n" } ], "responses": { @@ -8518,7 +8518,7 @@ "Tasks" ], "summary": "Start a task run, overriding the schedule", - "description": "Schedules a task run to start immediately, ignoring scheduled runs.\n\nUse this endpoint to manually start a task run.\nScheduled runs will continue to run as scheduled.\nThis may result in concurrently running tasks.\n\nTo _retry_ a previous run (and avoid creating a new run),\nuse the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry).\n\n#### Limitations\n\n- Queuing a task run requires that the task's `status` property be set to `active`.\n", + "description": "Schedules a task run to start immediately, ignoring scheduled runs.\n\nUse this endpoint to manually start a task run.\nScheduled runs will continue to run as scheduled.\nThis may result in concurrently running tasks.\n\nTo _retry_ a previous run (and avoid creating a new run),\nuse the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8529,8 +8529,7 @@ "schema": { "type": "string" }, - "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto run.\n" + "required": true } ], "requestBody": { @@ -8553,25 +8552,6 @@ } } }, - "400": { - "description": "Bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "inactiveTask": { - "summary": "Can't run an inactive task", - "value": { - "code": "invalid", - "message": "failed to force run: inactive task" - } - } - } - } - } - }, "401": { "$ref": "#/components/responses/AuthorizationError" }, @@ -8591,7 +8571,7 @@ "Tasks" ], "summary": "Retrieve a run for a task.", - "description": "Retrieves the specified run for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to retrieve detail and logs for a specific task run.\n", + "description": "Retrieves a specific run for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to retrieve detail and logs for a specific task run.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8603,7 +8583,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nthat the task run belongs to.\n" + "description": "The ID of the task to retrieve runs for." }, { "in": "path", @@ -8612,7 +8592,7 @@ "type": "string" }, "required": true, - "description": "A task run ID. Specifies the run to retrieve." + "description": "The ID of the run to retrieve." } ], "responses": { @@ -8681,7 +8661,7 @@ "Tasks" ], "summary": "Cancel a running task", - "description": "Cancels a running [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to cancel a running task.\n\n#### InfluxDB Cloud\n\n- Doesn't support this operation.\n", + "description": "Cancels a running [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint with InfluxDB OSS to cancel a running task.\n\n#### InfluxDB Cloud\n\n- Doesn't support this operation.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8693,7 +8673,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto cancel.\n" + "description": "The ID of the task to cancel." }, { "in": "path", @@ -8702,7 +8682,7 @@ "type": "string" }, "required": true, - "description": "A task run ID.\nSpecifies the task run to cancel.\n" + "description": "The ID of the task run to cancel." } ], "responses": { @@ -8744,7 +8724,7 @@ "Tasks" ], "summary": "Retry a task run", - "description": "Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to\nretry and then returns the scheduled run.\n\nTo manually start a _new_ task run, use the\n[`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns).\n\n#### Limitations\n\n- Queuing a task run requires that the task's `status` property be set to `active`.\n", + "description": "Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to\nretry and returns the scheduled run.\n\nTo manually start a _new_ task run, use the\n[`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns).\n\n#### Limitations\n\n- The task must be _active_ (`status: \"active\"`).\n", "requestBody": { "content": { "application/json; charset=utf-8": { @@ -8765,7 +8745,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the task run belongs to.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task to retry.\n" }, { "in": "path", @@ -8774,7 +8754,7 @@ "type": "string" }, "required": true, - "description": "A task run ID.\nSpecifies the task run to retry.\n\nTo find a task run ID, use the\n[`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns)\nto list task runs.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run ID.\nSpecifies the task run to retry.\n\nTo find a task run ID, use the\n[`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns)\nto list task runs.\n" } ], "responses": { @@ -8846,8 +8826,8 @@ "tags": [ "Tasks" ], - "summary": "List logs for a task", - "description": "Lists all log events for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nWhen a task runs, InfluxDB creates a `run` record in the task’s history.\nLogs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt.\n\nUse this endpoint to retrieve only the log events for a task,\nwithout additional task metadata.\n", + "summary": "Retrieve all logs for a task", + "description": "Retrieves a list of all logs for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nWhen an InfluxDB task runs, a “run” record is created in the task’s history.\nLogs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt.\n\nUse this endpoint to retrieve only the log events for a task,\nwithout additional task metadata.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8859,12 +8839,12 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve logs for." + "description": "The task ID." } ], "responses": { "200": { - "description": "Success.\nThe response body contains an `events` list with logs for the task.\nEach log event `message` contains detail about the event.\nIf a task run fails, InfluxDB logs an event with the reason for the failure.\n", + "description": "Success. The response body contains an `events` list with logs for the task.\nEach log event `message` contains detail about the event.\nIf a task run fails, InfluxDB logs an event with the reason for the failure.\n", "content": { "application/json": { "schema": { @@ -8872,7 +8852,7 @@ }, "examples": { "taskSuccess": { - "summary": "Events for a successful task run", + "summary": "Events for a successful task run.", "value": { "events": [ { @@ -8889,7 +8869,7 @@ } }, "taskFailure": { - "summary": "Events for a failed task run", + "summary": "Events for a failed task run.", "value": { "events": [ { @@ -8938,8 +8918,8 @@ "tags": [ "Tasks" ], - "summary": "List logs for a run", - "description": "Lists all logs for a task run.\nA log is a list of run events with `runID`, `time`, and `message` properties.\n\nUse this endpoint to help analyze [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) performance and troubleshoot failed task runs.\n", + "summary": "Retrieve all logs for a run", + "description": "Retrieves all logs for a task run.\nA log is a list of run events with `runID`, `time`, and `message` properties.\n\nUse this endpoint to help analyze task performance and troubleshoot failed task runs.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8951,7 +8931,7 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the run belongs to." + "description": "The ID of the task to get logs for." }, { "in": "path", @@ -8960,7 +8940,7 @@ "type": "string" }, "required": true, - "description": "A run ID. Specifies the task run to list logs for." + "description": "The ID of the run to get logs for." } ], "responses": { @@ -9040,7 +9020,7 @@ "Tasks" ], "summary": "List labels for a task", - "description": "Lists all labels for a task.\n\nUse this endpoint to list labels applied to a task.\nLabels are a way to add metadata to InfluxDB resources.\nYou can use labels for grouping and filtering resources in the\nInfluxDB UI, `influx` CLI, and InfluxDB API.\n", + "description": "Retrieves a list of all labels for a task.\n\nLabels may be used for grouping and filtering tasks.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9052,7 +9032,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the task to retrieve labels for.\n" + "description": "The ID of the task to retrieve labels for." } ], "responses": { @@ -9089,7 +9069,7 @@ "Tasks" ], "summary": "Add a label to a task", - "description": "Adds a label to a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to add a label to a task.\nLabels are a way to add metadata to InfluxDB resources.\nYou can use labels for grouping and filtering resources in the\nInfluxDB UI, `influx` CLI, and InfluxDB API.\n", + "description": "Adds a label to a task.\n\nUse this endpoint to add a label that you can use to filter tasks in the InfluxDB UI.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9101,11 +9081,11 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to label.\n" + "description": "The ID of the task to label." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the label.\n", + "description": "An object that contains a _`labelID`_ to add to the task.", "required": true, "content": { "application/json": { @@ -9117,7 +9097,7 @@ }, "responses": { "201": { - "description": "Success. The response body contains the label.", + "description": "Success. The response body contains a list of all labels for the task.", "content": { "application/json": { "schema": { @@ -9151,7 +9131,7 @@ "Tasks" ], "summary": "Delete a label from a task", - "description": "Deletes a label from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "Deletes a label from a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9163,7 +9143,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete the label from.\n" + "description": "The ID of the task to delete the label from." }, { "in": "path", @@ -9172,7 +9152,7 @@ "type": "string" }, "required": true, - "description": "A label ID.\nSpecifies the label to delete.\n" + "description": "The ID of the label to delete." } ], "responses": { @@ -9345,7 +9325,7 @@ "Tasks" ], "summary": "List all task members", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nLists all users that have the `member` role for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9357,12 +9337,12 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve members for.\n" + "description": "The task ID." } ], "responses": { "200": { - "description": "Success. The response body contains a list of `users` that have\nthe `member` role for a task.\n\nIf the task has no members, the response contains an empty `users` array.\n", + "description": "Success. The response body contains a list of `users` that have\nthe `member` role for a task.\n", "content": { "application/json": { "schema": { @@ -9390,7 +9370,7 @@ "Tasks" ], "summary": "Add a member to a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a specified user to members of the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and then returns\nthe member.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9402,11 +9382,11 @@ "type": "string" }, "required": true, - "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task for the member.\n" + "description": "The task ID." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the user.\n", + "description": "A user to add as a member of the task.", "required": true, "content": { "application/json": { @@ -9418,7 +9398,7 @@ }, "responses": { "201": { - "description": "Created. The task `member` role is assigned to the user.\nThe response body contains the resource member with\nrole and user detail.\n", + "description": "Created. The user is added to task members.", "content": { "application/json": { "schema": { @@ -9448,7 +9428,7 @@ "Tasks" ], "summary": "Remove a member from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRemoves a member from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9460,7 +9440,7 @@ "type": "string" }, "required": true, - "description": "A user ID. Specifies the member to remove." + "description": "The ID of the member to remove." }, { "in": "path", @@ -9469,12 +9449,12 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the member from." + "description": "The task ID." } ], "responses": { "204": { - "description": "Success. The member is removed." + "description": "Member removed" }, "default": { "description": "Unexpected error", @@ -9497,7 +9477,7 @@ "Tasks" ], "summary": "List all owners of a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nLists all users that have the `owner` role for the specified task.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9509,7 +9489,7 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the task to retrieve owners for." + "description": "The ID of the task to retrieve owners for." } ], "responses": { @@ -9558,7 +9538,7 @@ "Tasks" ], "summary": "Add an owner for a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a specified user to owners of the specified task and then returns the\nowner.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9570,11 +9550,11 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) for the owner.\n" + "description": "The task ID." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the user.\n", + "description": "A user to add as an owner of the task.", "required": true, "content": { "application/json": { @@ -9647,7 +9627,7 @@ "Tasks" ], "summary": "Remove an owner from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRemoves an owner from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9659,7 +9639,7 @@ "type": "string" }, "required": true, - "description": "A user ID. Specifies the owner to remove from the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)." + "description": "The ID of the owner to remove." }, { "in": "path", @@ -9668,12 +9648,12 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the owner from.\n" + "description": "The task ID." } ], "responses": { "204": { - "description": "Success. The owner is removed." + "description": "Owner removed" }, "default": { "description": "Unexpected error", @@ -13068,8 +13048,8 @@ "Data I/O endpoints", "Tasks" ], - "summary": "List tasks", - "description": "Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nTo limit which tasks are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all tasks up to the default `limit`.\n\n#### Related guide\n\n- [Process data with InfluxDB tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/)\n", + "summary": "List all tasks", + "description": "Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nTo limit which tasks are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all tasks up to the default `limit`.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -13077,7 +13057,7 @@ { "in": "query", "name": "name", - "description": "A task name.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) with the specified name.\nDifferent tasks may have the same name.\n", + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name.\nOnly returns tasks with the specified name.\nDifferent tasks may have the same name.\n", "schema": { "type": "string" } @@ -13088,7 +13068,7 @@ "schema": { "type": "string" }, - "description": "A task ID.\nOnly returns [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nOnly returns tasks created after the specified task.\n" }, { "in": "query", @@ -13096,7 +13076,7 @@ "schema": { "type": "string" }, - "description": "A user ID.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + "description": "A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID.\nOnly returns tasks owned by the specified user.\n" }, { "in": "query", @@ -13104,7 +13084,7 @@ "schema": { "type": "string" }, - "description": "An organization name.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name.\nOnly returns tasks owned by the specified organization.\n" }, { "in": "query", @@ -13112,7 +13092,7 @@ "schema": { "type": "string" }, - "description": "An organization ID.\nOnly returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID.\nOnly returns tasks owned by the specified organization.\n" }, { "in": "query", @@ -13124,7 +13104,7 @@ "inactive" ] }, - "description": "A task status.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status.\nOnly returns tasks that have the specified status (`active` or `inactive`).\n" }, { "in": "query", @@ -13161,7 +13141,7 @@ { "in": "query", "name": "sortBy", - "description": "The sort field.\nSpecifies the task property used to sort records in the list.\nDefault is `name`.\n\nThe parameter has one supported value: `name`.\n", + "description": "The sort field. Only `name` is supported.\nSpecifies the field used to sort records in the list.\n", "required": false, "schema": { "type": "string", @@ -13173,7 +13153,7 @@ { "in": "query", "name": "type", - "description": "A task type.\nSpecifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response.\nDefault is `system`.\n\nThe default (`system`) response contains all the metadata properties for tasks.\nTo reduce the response size, set the `type` parameter to `basic` (`type=basic`)\nto omit some task properties (`flux`, `createdAt`, `updatedAt`).\n", + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`).\nDefault is `system`.\nSpecifies the level of detail for tasks in the response.\nThe default (`system`) response contains all the metadata properties for tasks.\nTo reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`).\n", "required": false, "schema": { "default": "", @@ -13187,7 +13167,7 @@ { "in": "query", "name": "scriptID", - "description": "A script ID.\nOnly returns tasks that use the specified [invokable script](#tag/Invokable-Scripts).\n", + "description": "A [script](#tag/Invokable-Scripts) ID.\nOnly returns tasks that use the specified invokable script.\n", "schema": { "type": "string" } @@ -13298,34 +13278,26 @@ "Tasks" ], "summary": "Create a task", - "description": "Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task.\n\nUse this endpoint to create a scheduled task that runs a script.\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Create a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/)\n- [Common tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", + "description": "Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task.\n\nUse this endpoint to create a scheduled task that runs a Flux script.\n\n#### InfluxDB Cloud\n\n- You can use either `flux` or `scriptID` to provide the task script.\n\n - `flux`: a string of \"raw\" Flux that contains task options and the script--for example:\n\n ```json\n {\n \"flux\": \"option task = {name: \\\"CPU Total 1 Hour New\\\", every: 1h}\\\n from(bucket: \\\"telegraf\\\")\n |> range(start: -1h)\n |> filter(fn: (r) => (r._measurement == \\\"cpu\\\"))\n |> filter(fn: (r) =>\\n\\t\\t(r._field == \\\"usage_system\\\"))\n |> filter(fn: (r) => (r.cpu == \\\"cpu-total\\\"))\n |> aggregateWindow(every: 1h, fn: max)\n |> to(bucket: \\\"cpu_usage_user_total_1h\\\", org: \\\"INFLUX_ORG\\\")\",\n \"status\": \"active\",\n \"description\": \"This task downsamples CPU data every hour\"\n }\n ```\n\n - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts)\n for the task to run.\n To pass task options when using `scriptID`, pass the options as\n properties in the request body--for example:\n\n ```json\n {\n \"name\": \"CPU Total 1 Hour New\",\n \"description\": \"This task downsamples CPU data every hour\",\n \"every\": \"1h\",\n \"scriptID\": \"SCRIPT_ID\",\n \"scriptParameters\":\n {\n \"rangeStart\": \"-1h\",\n \"bucket\": \"telegraf\",\n \"filterField\": \"cpu-total\"\n }\n }\n ```\n\n#### Limitations:\n\n- You can't use `flux` and `scriptID` for the same task.\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Create a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/)\n- [Common tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" } ], "requestBody": { - "description": "In the request body, provide the task.\n\nSet one of the following properties to provide the script that the task runs:\n - `flux`\n - `scriptID`\n\nIf you set the `scriptID` property, you can set the following properties to configure the task:\n - `cron`\n - `every`\n - `offset`\n - `scriptParameters`\n\nIf you set the `flux` property, you must provide the `task` configuration option\nin the Flux script.\n\nSee [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\nfor detail and examples.\n\n#### Limitations:\n\n- You can't use `flux` and `scriptID` in the same task.\n", + "description": "The task to create", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskCreateRequest" - }, - "examples": { - "TaskWithFlux": { - "$ref": "#/components/examples/TaskWithFluxRequest" - }, - "TaskWithScriptID": { - "$ref": "#/components/examples/TaskWithScriptRequest" - } } } } }, "responses": { "201": { - "description": "Success. The response body contains a `tasks` list with the task.", + "description": "Success. The response body contains a `tasks` list with the new task.", "content": { "application/json": { "schema": { @@ -13335,7 +13307,7 @@ } }, "400": { - "description": "Bad request.\nThe response body contains detail about the error.\n\n#### InfluxDB Cloud\n\n- Returns this error if the task doesn't contain the `flux` property\n or the `scriptID` property.\n- Returns this error if the task contains `flux` _and_ `scriptID`\n properties.\n", + "description": "Bad request.\nThe response body contains detail about the error.\n\n#### InfluxDB Cloud\n\n- Returns this error if the task doesn't contain one of _`flux`_ or _`scriptID`_.\n- Returns this error if the task contains _`flux`_ _and_ _`scriptID`_.\n", "content": { "application/json": { "schema": { @@ -13376,7 +13348,19 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "Shell", + "label": "cURL: create a Flux script task", + "source": "curl INFLUX_URL/api/v2/tasks \\\n--header \"Content-type: application/json\" \\\n--header \"Authorization: Token INFLUX_API_TOKEN\" \\\n--data-binary @- << EOF\n {\n \"orgID\": \"INFLUX_ORG_ID\",\n \"description\": \"IoT Center 30d environment average.\",\n \"flux\": \"option task = {name: \\\"iot-center-task-1\\\", every: 30m}\\\n from(bucket: \\\"iot_center\\\")\\\n |> range(start: -30d)\\\n |> filter(fn: (r) => r._measurement == \\\"environment\\\")\\\n |> aggregateWindow(every: 1h, fn: mean)\"\n }\nEOF\n" + }, + { + "lang": "Shell", + "label": "cURL: create a Flux script reference task", + "source": "curl INFLUX_URL/api/v2/tasks \\\n--header \"Content-type: application/json\" \\\n--header \"Authorization: Token INFLUX_API_TOKEN\" \\\n--data-binary @- << EOF\n {\n \"orgID\": \"INFLUX_ORG_ID\",\n \"description\": \"IoT Center 30d environment average.\",\n \"scriptID\": \"085138a111448000\",\n \"scriptParameters\":\n {\n \"rangeStart\": \"-30d\",\n \"bucket\": \"air_sensor\",\n \"filterField\": \"temperature\",\n \"groupColumn\": \"_time\"\n }\n }\nEOF\n" + } + ] } }, "/tasks/{taskID}": { @@ -13387,7 +13371,7 @@ "Tasks" ], "summary": "Retrieve a task", - "description": "Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -13399,7 +13383,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task to retrieve.\n" } ], "responses": { @@ -13436,22 +13420,14 @@ "Tasks" ], "summary": "Update a task", - "description": "Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task),\nand then cancels all scheduled runs of the task.\n\nUse this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`.\nOnce InfluxDB applies the update, it cancels all previously scheduled runs of the task.\n\nTo activate or inactivate a task, set the `status` property.\nThe `status` property set to `inactive` cancels scheduled runs and prevents manual runs of the task.\n\n#### Related guides\n\n- [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", + "description": "Updates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task),\nand then cancels all scheduled runs of the task.\n\nUse this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`.\nOnce InfluxDB applies the update, it cancels all previously scheduled runs of the task.\n\nTo update a task, pass an object that contains the updated key-value pairs.\nTo activate or inactivate a task, set the `status` property.\n_`\"status\": \"inactive\"`_ cancels scheduled runs and prevents manual runs of the task.\n\n#### InfluxDB Cloud\n\n- Use either `flux` or `scriptID` to provide the task script.\n\n - `flux`: a string of \"raw\" Flux that contains task options and the script--for example:\n\n ```json\n {\n \"flux\": \"option task = {name: \\\"CPU Total 1 Hour New\\\", every: 1h}\\\n from(bucket: \\\"telegraf\\\")\n |> range(start: -1h)\n |> filter(fn: (r) => (r._measurement == \\\"cpu\\\"))\n |> filter(fn: (r) =>\\n\\t\\t(r._field == \\\"usage_system\\\"))\n |> filter(fn: (r) => (r.cpu == \\\"cpu-total\\\"))\n |> aggregateWindow(every: 1h, fn: max)\n |> to(bucket: \\\"cpu_usage_user_total_1h\\\", org: \\\"INFLUX_ORG\\\")\",\n \"status\": \"active\",\n \"description\": \"This task downsamples CPU data every hour\"\n }\n ```\n\n - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts)\n for the task to run.\n To pass task options when using `scriptID`, pass the options as\n properties in the request body--for example:\n\n ```json\n {\n \"name\": \"CPU Total 1 Hour New\",\n \"description\": \"This task downsamples CPU data every hour\",\n \"every\": \"1h\",\n \"scriptID\": \"SCRIPT_ID\",\n \"scriptParameters\":\n {\n \"rangeStart\": \"-1h\",\n \"bucket\": \"telegraf\",\n \"filterField\": \"cpu-total\"\n }\n }\n ```\n\n#### Limitations:\n\n- You can't use `flux` and `scriptID` for the same task.\n", "requestBody": { - "description": "In the request body, provide the task properties to update.\nTo provide the script that the task runs,\nset either the `flux` property or the `scriptID` property.\n\nIf you set `scriptID`, you can set the following properties to configure the task:\n - `cron`\n - `every`\n - `offset`\n - `scriptParameters`\n\nIf you set the `flux` property, provide the `task` configuration option\nin the Flux script.\n\nSee [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\nfor detail and examples.\n\n#### Limitations:\n\n- You can't set `flux` and `scriptID` properties for the same task--for\n example, if you set the `scriptID` property, then InfluxDB sets the `flux` property\n to an empty string (`\"\"`).\n", + "description": "An task update to apply.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskUpdateRequest" - }, - "examples": { - "TaskWithFlux": { - "$ref": "#/components/examples/TaskWithFluxRequest" - }, - "TaskWithScriptID": { - "$ref": "#/components/examples/TaskWithScriptRequest" - } } } } @@ -13467,7 +13443,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to update.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task to update.\n" } ], "responses": { @@ -13504,7 +13480,7 @@ "Tasks" ], "summary": "Delete a task", - "description": "Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nand all associated records (task runs, logs, and labels).\nOnce the task is deleted, InfluxDB cancels all scheduled runs of the task.\n\nTo disable a task instead of delete it, use\n[`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task's `status`\nproperty to `inactive`.\n", + "description": "Deletes a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and associated records.\n\nUse this endpoint to delete a task and all associated records (task runs, logs, and labels).\nOnce the task is deleted, InfluxDB cancels all scheduled runs of the task.\n\nIf you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -13516,7 +13492,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to delete." } ], "responses": { @@ -16583,42 +16559,6 @@ } } }, - "TaskCron": { - "description": "A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.", - "type": "string", - "format": "cron" - }, - "TaskDescription": { - "description": "A description of the task.", - "type": "string" - }, - "TaskEvery": { - "description": "The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.", - "type": "string", - "format": "duration" - }, - "TaskFlux": { - "description": "Flux with [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\nand the script for the task to run.\n\n#### Related guides\n\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", - "type": "string", - "format": "Flux" - }, - "TaskName": { - "description": "The name of the task.", - "type": "string" - }, - "TaskOffset": { - "description": "A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.", - "type": "string", - "format": "duration" - }, - "TaskOrg": { - "description": "An organization name.\nIdentifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task.\n", - "type": "string" - }, - "TaskOrgID": { - "description": "An organization ID.\nIdentifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task.\n", - "type": "string" - }, "TaskStatusType": { "type": "string", "enum": [ @@ -21875,23 +21815,26 @@ "properties": { "id": { "readOnly": true, - "type": "string", - "description": "The resource ID that InfluxDB uses to uniquely identify the task.\n" + "type": "string" }, "orgID": { - "$ref": "#/components/schemas/TaskOrgID" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID.\nSpecifies the organization that owns the task.\n", + "type": "string" }, "org": { - "$ref": "#/components/schemas/TaskOrg" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name.\nSpecifies the organization that owns the task.\n", + "type": "string" }, "name": { - "$ref": "#/components/schemas/TaskName" - }, - "description": { - "$ref": "#/components/schemas/TaskDescription" + "description": "The name of the task.", + "type": "string" }, "ownerID": { - "description": "A user ID.\nIdentifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the task.\n\nTo find a user ID, use the\n[`GET /api/v2/users` endpoint](#operation/GetUsers) to\nlist users.\n", + "description": "A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID.\nSpecifies the owner of the task.\n\nTo find a user ID, you can use the\n[`GET /api/v2/users` endpoint](#operation/GetUsers) to\nlist users.\n", + "type": "string" + }, + "description": { + "description": "A description of the task.", "type": "string" }, "status": { @@ -21901,20 +21844,27 @@ "$ref": "#/components/schemas/Labels" }, "authorizationID": { - "description": "An authorization ID.\nIdentifies the authorization used when the task communicates with the query engine.\n\nTo find an authorization ID, use the\n[`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to\nlist authorizations.\n", + "description": "An authorization ID.\nSpecifies the authorization used when the task communicates with the query engine.\n\nTo find an authorization ID, use the\n[`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to\nlist authorizations.\n", "type": "string" }, "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": "The Flux script that the task executes.\n\n#### Limitations\n - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties.\n", + "type": "string", + "format": "flux" }, "every": { - "$ref": "#/components/schemas/TaskEvery" + "description": "The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.", + "type": "string", + "format": "duration" }, "cron": { - "$ref": "#/components/schemas/TaskCron" + "description": "A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.", + "type": "string" }, "offset": { - "$ref": "#/components/schemas/TaskOffset" + "description": "A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.", + "type": "string", + "format": "duration" }, "latestCompleted": { "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.", @@ -21978,10 +21928,12 @@ } }, "scriptID": { - "$ref": "#/components/schemas/TaskScriptID" + "description": "A script ID.\nSpecifies the [invokable script](#tag/Invokable-Scripts) that the task executes.\n\n#### Limitations\n\n- If you use the `scriptID` property, you can't use the `flux` property.\n\n#### Related guides\n\n- [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script)\n", + "type": "string" }, "scriptParameters": { - "$ref": "#/components/schemas/TaskScriptParameters" + "description": "Key-value pairs for `params` in the script.\nDefines the invocation parameter values passed to the script specified by `scriptID`.\nWhen running the task, InfluxDB executes the script with the parameters\nyou provide.\n\n#### Limitations\n\n- To use `scriptParameters`, you must provide a `scriptID`.\n- If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property.\n", + "type": "object" } }, "required": [ @@ -21994,77 +21946,88 @@ "type": "object", "properties": { "orgID": { - "$ref": "#/components/schemas/TaskOrgID" + "description": "The ID of the organization that owns the task.", + "type": "string" }, "org": { - "$ref": "#/components/schemas/TaskOrg" - }, - "name": { - "$ref": "#/components/schemas/TaskName" - }, - "description": { - "$ref": "#/components/schemas/TaskDescription" - }, - "every": { - "$ref": "#/components/schemas/TaskEvery" - }, - "cron": { - "$ref": "#/components/schemas/TaskCron" - }, - "offset": { - "$ref": "#/components/schemas/TaskOffset" + "description": "The name of the organization that owns the task.", + "type": "string" }, "status": { "$ref": "#/components/schemas/TaskStatusType" }, "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": "The Flux script that the task runs.\n\n#### Limitations\n\n- If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties.\n", + "type": "string" + }, + "description": { + "description": "The description of the task.", + "type": "string" }, "scriptID": { - "$ref": "#/components/schemas/TaskScriptID" + "description": "The ID of the script that the task runs.\n\n#### Limitations\n\n- If you use the `scriptID` property, you can't use the `flux` property.\n", + "type": "string" }, "scriptParameters": { - "$ref": "#/components/schemas/TaskScriptParameters" + "description": "The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run.\n\n#### Limitations\n\n- `scriptParameters` requires `scriptID`.\n- If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property.\n", + "type": "object" + }, + "name": { + "description": "The name of the task", + "type": "string" + }, + "every": { + "description": "The interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs.\n`every` also determines when the task first runs, depending on the specified time.\n", + "type": "string" + }, + "cron": { + "description": "A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.", + "type": "string" + }, + "offset": { + "description": "A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.", + "type": "string", + "format": "duration" } } }, - "TaskScriptID": { - "description": "A script ID.\nIdentifies the [invokable script](#tag/Invokable-Scripts) that the task runs.\n\n#### Related guides\n\n- [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script).\n", - "type": "string" - }, - "TaskScriptParameters": { - "description": "Key-value pairs for `params` in the script.\nDefines the invocation parameter values passed to the [invokable script](#tag/Invokable-Scripts) specified\nby the `scriptID` property.\nWhen running the task, InfluxDB executes the script with the parameters\nyou provide.\n\n#### Limitations\n\n- To use the `scriptParameters` property, you must also set the `scriptID` property\n for the task.\n\n#### Related guides\n\n- [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script).\n", - "type": "object" - }, "TaskUpdateRequest": { "type": "object", "properties": { "status": { "$ref": "#/components/schemas/TaskStatusType" }, - "name": { - "$ref": "#/components/schemas/TaskName" + "flux": { + "description": "Update the Flux script that the task runs.", + "type": "string" }, - "description": { - "$ref": "#/components/schemas/TaskDescription" + "name": { + "description": "Update the 'name' option in the flux script.", + "type": "string" }, "every": { - "$ref": "#/components/schemas/TaskEvery" + "description": "Update the 'every' option in the flux script.", + "type": "string" }, "cron": { - "$ref": "#/components/schemas/TaskCron" + "description": "Update the 'cron' option in the flux script.", + "type": "string" }, "offset": { - "$ref": "#/components/schemas/TaskOffset" + "description": "Update the 'offset' option in the flux script.", + "type": "string" }, - "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": { + "description": "Update the description of the task.", + "type": "string" }, "scriptID": { - "$ref": "#/components/schemas/TaskScriptID" + "description": "Update the 'scriptID' of the task.", + "type": "string" }, "scriptParameters": { - "$ref": "#/components/schemas/TaskScriptParameters" + "description": "Update the 'scriptParameters' of the task.", + "type": "object" } } } @@ -22232,7 +22195,7 @@ "summary": "A task with Flux", "description": "Sets the `flux` property with Flux task options and a query.", "value": { - "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", "status": "active", "description": "This task contains Flux that configures the task schedule and downsamples CPU data every hour." } diff --git a/contracts/cloud.yml b/contracts/cloud.yml index 4cb7b52ed..8260a1882 100644 --- a/contracts/cloud.yml +++ b/contracts/cloud.yml @@ -7216,11 +7216,10 @@ paths: - Tasks summary: List runs for a task description: | - Lists runs for the specified [task](https://docs.influxdata.com/influxdb/cloud/process-data/). + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/cloud/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7229,14 +7228,13 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. - in: query name: after schema: type: string - description: A task run ID. Only returns runs created after the specified run. + description: A task run ID. Only returns runs created after this run. - in: query name: limit schema: @@ -7253,7 +7251,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. - in: query name: beforeTime schema: @@ -7261,7 +7259,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. responses: '200': description: Success. The response body contains the list of task runs. @@ -7290,10 +7288,6 @@ paths: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7301,10 +7295,6 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to run. requestBody: content: application/json: @@ -7317,18 +7307,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Run' - '400': - description: Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - inactiveTask: - summary: Can't run an inactive task - value: - code: invalid - message: 'failed to force run: inactive task' '401': $ref: '#/components/responses/AuthorizationError' '500': @@ -7342,7 +7320,7 @@ paths: - Tasks summary: Retrieve a run for a task. description: | - Retrieves the specified run for the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. parameters: @@ -7352,16 +7330,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - that the task run belongs to. + description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true - description: A task run ID. Specifies the run to retrieve. + description: The ID of the run to retrieve. responses: '200': description: Success. The response body contains the task run. @@ -7410,7 +7385,7 @@ paths: description: | Cancels a running [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -7422,18 +7397,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to cancel. + description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true - description: | - A task run ID. - Specifies the task run to cancel. + description: The ID of the task run to cancel. responses: '204': description: | @@ -7475,15 +7445,15 @@ paths: - Tasks summary: Retry a task run description: | - Queues a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). requestBody: content: application/json; charset=utf-8: @@ -7497,15 +7467,15 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) that the task run belongs to. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to retry. - in: path name: runID schema: type: string required: true description: | - A task run ID. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the @@ -7563,12 +7533,12 @@ paths: operationId: GetTasksIDLogs tags: - Tasks - summary: List logs for a task + summary: Retrieve all logs for a task description: | - Lists all log events for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. @@ -7579,12 +7549,11 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to retrieve logs for.' + description: The task ID. responses: '200': description: | - Success. - The response body contains an `events` list with logs for the task. + Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. content: @@ -7593,7 +7562,7 @@ paths: $ref: '#/components/schemas/Logs' examples: taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: events: - runID: 09b070dadaa7d000 @@ -7603,7 +7572,7 @@ paths: time: '2022-07-18T14:46:07.242859Z' message: Completed(success) taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: events: - runID: 09a946fc3167d000 @@ -7630,12 +7599,12 @@ paths: operationId: GetTasksIDRunsIDLogs tags: - Tasks - summary: List logs for a run + summary: Retrieve all logs for a run description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7643,13 +7612,13 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) that the run belongs to.' + description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true - description: A run ID. Specifies the task run to list logs for. + description: The ID of the run to get logs for. responses: '200': description: | @@ -7701,12 +7670,9 @@ paths: - Tasks summary: List labels for a task description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7714,9 +7680,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the task to retrieve labels for. + description: The ID of the task to retrieve labels for. responses: '200': description: Success. The response body contains a list of all labels for the task. @@ -7740,12 +7704,9 @@ paths: - Tasks summary: Add a label to a task description: | - Adds a label to a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7753,12 +7714,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to label. + description: The ID of the task to label. requestBody: - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: @@ -7766,7 +7724,7 @@ paths: $ref: '#/components/schemas/LabelMapping' responses: '201': - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: @@ -7788,7 +7746,7 @@ paths: - Tasks summary: Delete a label from a task description: | - Deletes a label from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Deletes a label from a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7796,17 +7754,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to delete the label from. + description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true - description: | - A label ID. - Specifies the label to delete. + description: The ID of the label to delete. responses: '204': description: Success. The label is deleted. @@ -7977,9 +7931,7 @@ paths: summary: List all task members description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7987,16 +7939,12 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to retrieve members for. + description: The task ID. responses: '200': description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. content: application/json: schema: @@ -8017,8 +7965,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8026,12 +7973,9 @@ paths: schema: type: string required: true - description: | - A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. - Specifies the task for the member. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true content: application/json: @@ -8039,10 +7983,7 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. content: application/json: schema: @@ -8062,9 +8003,7 @@ paths: summary: Remove a member from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8072,16 +8011,16 @@ paths: schema: type: string required: true - description: A user ID. Specifies the member to remove. + description: The ID of the member to remove. - in: path name: taskID schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to remove the member from.' + description: The task ID. responses: '204': - description: Success. The member is removed. + description: Member removed default: description: Unexpected error content: @@ -8099,7 +8038,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8107,7 +8046,7 @@ paths: schema: type: string required: true - description: A task ID. Specifies the task to retrieve owners for. + description: The ID of the task to retrieve owners for. responses: '200': description: | @@ -8151,8 +8090,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. @@ -8163,12 +8101,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) for the owner. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true content: application/json: @@ -8227,8 +8162,6 @@ paths: description: | **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes an owner from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8236,18 +8169,16 @@ paths: schema: type: string required: true - description: 'A user ID. Specifies the owner to remove from the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task).' + description: The ID of the owner to remove. - in: path name: taskID schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to remove the owner from. + description: The task ID. responses: '204': - description: Success. The owner is removed. + description: Owner removed default: description: Unexpected error content: @@ -10802,23 +10733,19 @@ paths: tags: - Data I/O endpoints - Tasks - summary: List tasks + summary: List all tasks description: | - Lists [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. - - #### Related guide - - - [Process data with InfluxDB tasks](https://docs.influxdata.com/influxdb/cloud/process-data/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: query name: name description: | - A task name. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) with the specified name. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -10827,29 +10754,29 @@ paths: schema: type: string description: | - A task ID. - Only returns [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) created after the specified task. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) owned by the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + A [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) owned by the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns tasks owned by the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -10858,8 +10785,8 @@ paths: - active - inactive description: | - A task status. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) that have the specified status. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -10892,11 +10819,8 @@ paths: - in: query name: sortBy description: | - The sort field. - Specifies the task property used to sort records in the list. - Default is `name`. - - The parameter has one supported value: `name`. + The sort field. Only `name` is supported. + Specifies the field used to sort records in the list. required: false schema: type: string @@ -10905,13 +10829,11 @@ paths: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) in the response. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) type (`basic` or `system`). Default is `system`. - + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. - To reduce the response size, set the `type` parameter to `basic` (`type=basic`) - to omit some task properties (`flux`, `createdAt`, `updatedAt`). + To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false schema: default: '' @@ -10922,8 +10844,8 @@ paths: - in: query name: scriptID description: | - A script ID. - Only returns tasks that use the specified [invokable script](#tag/Invokable-Scripts). + A [script](#tag/Invokable-Scripts) ID. + Only returns tasks that use the specified invokable script. schema: type: string responses: @@ -11022,7 +10944,52 @@ paths: description: | Creates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and returns the task. - Use this endpoint to create a scheduled task that runs a script. + Use this endpoint to create a scheduled task that runs a Flux script. + + #### InfluxDB Cloud + + - You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -11033,41 +11000,15 @@ paths: parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: | - In the request body, provide the task. - - Set one of the following properties to provide the script that the task runs: - - `flux` - - `scriptID` - - If you set the `scriptID` property, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, you must provide the `task` configuration option - in the Flux script. - - See [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't use `flux` and `scriptID` in the same task. + description: The task to create required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' responses: '201': - description: Success. The response body contains a `tasks` list with the task. + description: Success. The response body contains a `tasks` list with the new task. content: application/json: schema: @@ -11079,10 +11020,8 @@ paths: #### InfluxDB Cloud - - Returns this error if the task doesn't contain the `flux` property - or the `scriptID` property. - - Returns this error if the task contains `flux` _and_ `scriptID` - properties. + - Returns this error if the task doesn't contain one of _`flux`_ or _`scriptID`_. + - Returns this error if the task contains _`flux`_ _and_ _`scriptID`_. content: application/json: schema: @@ -11108,6 +11047,44 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: 'cURL: create a Flux script task' + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF + - lang: Shell + label: 'cURL: create a Flux script reference task' + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "scriptID": "085138a111448000", + "scriptParameters": + { + "rangeStart": "-30d", + "bucket": "air_sensor", + "filterField": "temperature", + "groupColumn": "_time" + } + } + EOF '/tasks/{taskID}': get: operationId: GetTasksID @@ -11116,7 +11093,7 @@ paths: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -11125,8 +11102,8 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to retrieve. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to retrieve. responses: '200': description: Success. The response body contains the task. @@ -11150,52 +11127,67 @@ paths: - Tasks summary: Update a task description: | - Updates the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task), + Updates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. + To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. - The `status` property set to `inactive` cancels scheduled runs and prevents manual runs of the task. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. - #### Related guides + #### InfluxDB Cloud - - [Update a task](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/update-task/) - - [Task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - requestBody: - description: | - In the request body, provide the task properties to update. - To provide the script that the task runs, - set either the `flux` property or the `scriptID` property. + - Use either `flux` or `scriptID` to provide the task script. - If you set `scriptID`, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` + - `flux`: a string of "raw" Flux that contains task options and the script--for example: - If you set the `flux` property, provide the `task` configuration option - in the Flux script. + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: - See [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - for detail and examples. + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` - #### Limitations: + #### Limitations: - - You can't set `flux` and `scriptID` properties for the same task--for - example, if you set the `scriptID` property, then InfluxDB sets the `flux` property - to an empty string (`""`). + - You can't use `flux` and `scriptID` for the same task. + requestBody: + description: An task update to apply. required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -11204,8 +11196,8 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to update. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to update. responses: '200': description: Success. The response body contains the updated task. @@ -11229,13 +11221,12 @@ paths: - Tasks summary: Delete a task description: | - Deletes the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task's `status` - property to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -11243,9 +11234,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to delete. + description: 'A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. Specifies the task to delete.' responses: '204': description: Success. The task and task runs are deleted. Scheduled runs are canceled. @@ -13588,44 +13577,6 @@ components: Default is the server _now_ time. type: string format: date-time - TaskCron: - description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' - type: string - format: cron - TaskDescription: - description: A description of the task. - type: string - TaskEvery: - description: 'The interval ([duration literal](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' - type: string - format: duration - TaskFlux: - description: | - Flux with [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - type: string - format: Flux - TaskName: - description: The name of the task. - type: string - TaskOffset: - description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' - type: string - format: duration - TaskOrg: - description: | - An organization name. - Identifies the [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) that owns the task. - type: string - TaskOrgID: - description: | - An organization ID. - Identifies the [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) that owns the task. - type: string TaskStatusType: type: string enum: @@ -17270,25 +17221,31 @@ components: id: readOnly: true type: string - description: | - The resource ID that InfluxDB uses to uniquely identify the task. orgID: - $ref: '#/components/schemas/TaskOrgID' + description: | + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: | + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string name: - $ref: '#/components/schemas/TaskName' - description: - $ref: '#/components/schemas/TaskDescription' + description: The name of the task. + type: string ownerID: description: | - A user ID. - Identifies the [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) that owns the task. + A [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string + description: + description: A description of the task. + type: string status: $ref: '#/components/schemas/TaskStatusType' labels: @@ -17296,20 +17253,31 @@ components: authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to list authorizations. type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: | + The Flux script that the task executes. + + #### Limitations + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string + format: flux every: - $ref: '#/components/schemas/TaskEvery' + description: 'The interval ([duration literal](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' + type: string + format: duration cron: - $ref: '#/components/schemas/TaskCron' + description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' + type: string + format: duration latestCompleted: description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.' type: string @@ -17357,9 +17325,30 @@ components: labels: $ref: '#/components/schemas/Link' scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: | + A script ID. + Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes. + + #### Limitations + + - If you use the `scriptID` property, you can't use the `flux` property. + + #### Related guides + + - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: | + Key-value pairs for `params` in the script. + Defines the invocation parameter values passed to the script specified by `scriptID`. + When running the task, InfluxDB executes the script with the parameters + you provide. + + #### Limitations + + - To use `scriptParameters`, you must provide a `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object required: - id - name @@ -17368,74 +17357,85 @@ components: type: object properties: orgID: - $ref: '#/components/schemas/TaskOrgID' + description: The ID of the organization that owns the task. + type: string org: - $ref: '#/components/schemas/TaskOrg' - name: - $ref: '#/components/schemas/TaskName' - description: - $ref: '#/components/schemas/TaskDescription' - every: - $ref: '#/components/schemas/TaskEvery' - cron: - $ref: '#/components/schemas/TaskCron' - offset: - $ref: '#/components/schemas/TaskOffset' + description: The name of the organization that owns the task. + type: string status: $ref: '#/components/schemas/TaskStatusType' flux: - $ref: '#/components/schemas/TaskFlux' - scriptID: - $ref: '#/components/schemas/TaskScriptID' - scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' - TaskScriptID: - description: | - A script ID. - Identifies the [invokable script](#tag/Invokable-Scripts) that the task runs. + description: | + The Flux script that the task runs. - #### Related guides + #### Limitations - - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: string - TaskScriptParameters: - description: | - Key-value pairs for `params` in the script. - Defines the invocation parameter values passed to the [invokable script](#tag/Invokable-Scripts) specified - by the `scriptID` property. - When running the task, InfluxDB executes the script with the parameters - you provide. + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string + description: + description: The description of the task. + type: string + scriptID: + description: | + The ID of the script that the task runs. - #### Limitations + #### Limitations - - To use the `scriptParameters` property, you must also set the `scriptID` property - for the task. + - If you use the `scriptID` property, you can't use the `flux` property. + type: string + scriptParameters: + description: | + The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run. - #### Related guides + #### Limitations - - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: object + - `scriptParameters` requires `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object + name: + description: The name of the task + type: string + every: + description: | + The interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string + cron: + description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.' + type: string + offset: + description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' + type: string + format: duration TaskUpdateRequest: type: object properties: status: $ref: '#/components/schemas/TaskStatusType' + flux: + description: Update the Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/TaskName' - description: - $ref: '#/components/schemas/TaskDescription' + description: Update the 'name' option in the flux script. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: Update the 'every' option in the flux script. + type: string cron: - $ref: '#/components/schemas/TaskCron' + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: '#/components/schemas/TaskOffset' - flux: - $ref: '#/components/schemas/TaskFlux' + description: Update the 'offset' option in the flux script. + type: string + description: + description: Update the description of the task. + type: string scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: Update the 'scriptID' of the task. + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: Update the 'scriptParameters' of the task. + type: object responses: AuthorizationError: description: | @@ -17565,7 +17565,7 @@ components: summary: A task with Flux description: Sets the `flux` property with Flux task options and a query. value: - flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. TaskWithScriptRequest: diff --git a/contracts/common.yml b/contracts/common.yml index 3ee47f904..0eff9688b 100644 --- a/contracts/common.yml +++ b/contracts/common.yml @@ -6925,11 +6925,10 @@ paths: - Tasks summary: List runs for a task description: | - Lists runs for the specified [task](https://docs.influxdata.com/influxdb/latest/process-data/). + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/latest/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -6938,14 +6937,13 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. - in: query name: after schema: type: string - description: A task run ID. Only returns runs created after the specified run. + description: A task run ID. Only returns runs created after this run. - in: query name: limit schema: @@ -6962,7 +6960,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. - in: query name: beforeTime schema: @@ -6970,7 +6968,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. responses: '200': description: Success. The response body contains the list of task runs. @@ -6999,10 +6997,6 @@ paths: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7010,10 +7004,6 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to run. requestBody: content: application/json: @@ -7026,18 +7016,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Run' - '400': - description: Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - inactiveTask: - summary: Can't run an inactive task - value: - code: invalid - message: 'failed to force run: inactive task' '401': $ref: '#/components/responses/AuthorizationError' '500': @@ -7051,7 +7029,7 @@ paths: - Tasks summary: Retrieve a run for a task. description: | - Retrieves the specified run for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. parameters: @@ -7061,16 +7039,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that the task run belongs to. + description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true - description: A task run ID. Specifies the run to retrieve. + description: The ID of the run to retrieve. responses: '200': description: Success. The response body contains the task run. @@ -7119,7 +7094,7 @@ paths: description: | Cancels a running [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -7131,18 +7106,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to cancel. + description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true - description: | - A task run ID. - Specifies the task run to cancel. + description: The ID of the task run to cancel. responses: '204': description: | @@ -7184,15 +7154,15 @@ paths: - Tasks summary: Retry a task run description: | - Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). requestBody: content: application/json; charset=utf-8: @@ -7206,15 +7176,15 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the task run belongs to. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. + Specifies the task to retry. - in: path name: runID schema: type: string required: true description: | - A task run ID. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the @@ -7272,12 +7242,12 @@ paths: operationId: GetTasksIDLogs tags: - Tasks - summary: List logs for a task + summary: Retrieve all logs for a task description: | - Lists all log events for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. @@ -7288,12 +7258,11 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve logs for.' + description: The task ID. responses: '200': description: | - Success. - The response body contains an `events` list with logs for the task. + Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. content: @@ -7302,7 +7271,7 @@ paths: $ref: '#/components/schemas/Logs' examples: taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: events: - runID: 09b070dadaa7d000 @@ -7312,7 +7281,7 @@ paths: time: '2022-07-18T14:46:07.242859Z' message: Completed(success) taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: events: - runID: 09a946fc3167d000 @@ -7339,12 +7308,12 @@ paths: operationId: GetTasksIDRunsIDLogs tags: - Tasks - summary: List logs for a run + summary: Retrieve all logs for a run description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7352,13 +7321,13 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the run belongs to.' + description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true - description: A run ID. Specifies the task run to list logs for. + description: The ID of the run to get logs for. responses: '200': description: | @@ -7410,12 +7379,9 @@ paths: - Tasks summary: List labels for a task description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7423,9 +7389,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the task to retrieve labels for. + description: The ID of the task to retrieve labels for. responses: '200': description: Success. The response body contains a list of all labels for the task. @@ -7449,12 +7413,9 @@ paths: - Tasks summary: Add a label to a task description: | - Adds a label to a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7462,12 +7423,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to label. + description: The ID of the task to label. requestBody: - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: @@ -7475,7 +7433,7 @@ paths: $ref: '#/components/schemas/LabelMapping' responses: '201': - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: @@ -7497,7 +7455,7 @@ paths: - Tasks summary: Delete a label from a task description: | - Deletes a label from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Deletes a label from a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7505,17 +7463,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to delete the label from. + description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true - description: | - A label ID. - Specifies the label to delete. + description: The ID of the label to delete. responses: '204': description: Success. The label is deleted. @@ -7686,9 +7640,7 @@ paths: summary: List all task members description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7696,16 +7648,12 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve members for. + description: The task ID. responses: '200': description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. content: application/json: schema: @@ -7726,8 +7674,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7735,12 +7682,9 @@ paths: schema: type: string required: true - description: | - A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. - Specifies the task for the member. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true content: application/json: @@ -7748,10 +7692,7 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. content: application/json: schema: @@ -7771,9 +7712,7 @@ paths: summary: Remove a member from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7781,16 +7720,16 @@ paths: schema: type: string required: true - description: A user ID. Specifies the member to remove. + description: The ID of the member to remove. - in: path name: taskID schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to remove the member from.' + description: The task ID. responses: '204': - description: Success. The member is removed. + description: Member removed default: description: Unexpected error content: @@ -7808,7 +7747,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7816,7 +7755,7 @@ paths: schema: type: string required: true - description: A task ID. Specifies the task to retrieve owners for. + description: The ID of the task to retrieve owners for. responses: '200': description: | @@ -7860,8 +7799,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. @@ -7872,12 +7810,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) for the owner. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true content: application/json: @@ -7936,8 +7871,6 @@ paths: description: | **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes an owner from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7945,18 +7878,16 @@ paths: schema: type: string required: true - description: 'A user ID. Specifies the owner to remove from the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task).' + description: The ID of the owner to remove. - in: path name: taskID schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to remove the owner from. + description: The task ID. responses: '204': - description: Success. The owner is removed. + description: Owner removed default: description: Unexpected error content: @@ -11753,44 +11684,6 @@ components: Default is the server _now_ time. type: string format: date-time - TaskCron: - description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' - type: string - format: cron - TaskDescription: - description: A description of the task. - type: string - TaskEvery: - description: 'The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' - type: string - format: duration - TaskFlux: - description: | - Flux with [task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - type: string - format: Flux - TaskName: - description: The name of the task. - type: string - TaskOffset: - description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' - type: string - format: duration - TaskOrg: - description: | - An organization name. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string - TaskOrgID: - description: | - An organization ID. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string TaskStatusType: type: string enum: diff --git a/contracts/oss-diff.yml b/contracts/oss-diff.yml index a49023825..92c8b4878 100644 --- a/contracts/oss-diff.yml +++ b/contracts/oss-diff.yml @@ -1904,7 +1904,7 @@ paths: type: object properties: labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' links: $ref: '#/paths/~1dashboards/get/responses/200/content/application~1json/schema/properties/links' default: @@ -2959,17 +2959,17 @@ paths: org: /api/v2/labels/1 properties: self: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' cells: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -3012,7 +3012,7 @@ paths: type: string description: The reference to a view from the views API. labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' - type: object allOf: - $ref: '#/paths/~1dashboards/post/requestBody/content/application~1json/schema' @@ -3029,17 +3029,17 @@ paths: org: /api/v2/labels/1 properties: self: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' cells: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -3777,7 +3777,7 @@ paths: readOnly: true type: string labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' links: type: object readOnly: true @@ -3790,19 +3790,19 @@ paths: properties: self: description: The URL for this check. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: description: The URL to retrieve labels for this check. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: description: The URL to retrieve members for this check. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: description: The URL to retrieve owners for this check. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' query: description: The URL to retrieve the Flux script for this check. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' required: - name - orgID @@ -4621,7 +4621,7 @@ paths: items: $ref: '#/paths/~1dashboards/post/responses/201/content/application~1json/schema/oneOf/1/allOf/1/properties/cells/items/allOf/1/properties/properties/oneOf/0/properties/colors/items' labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' default: description: Unexpected error content: @@ -4703,11 +4703,11 @@ paths: URI pointers for additional paged results. properties: next: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' self: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' prev: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' required: - self dashboards: @@ -4728,7 +4728,7 @@ paths: - Tasks summary: List tasks description: | - Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -4741,9 +4741,8 @@ paths: - in: query name: name description: | - A task name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - that have the specified name. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -4752,30 +4751,29 @@ paths: schema: type: string description: | - A task ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - owned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -4784,8 +4782,8 @@ paths: - active - inactive description: | - A task status. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -4803,9 +4801,9 @@ paths: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`). Default is `system`. + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false @@ -4935,9 +4933,7 @@ paths: - Tasks summary: Create a task description: | - Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. - - Use this endpoint to create a scheduled task that runs a script. + Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. #### Related guides @@ -4948,20 +4944,12 @@ paths: parameters: - $ref: '#/paths/~1ready/get/parameters/0' requestBody: - description: | - In the request body, provide the task. - - #### InfluxDB OSS - - - Requires either the `org` parameter or the `orgID` parameter. + description: The task to create. required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' responses: '201': description: Success. The response body contains a `tasks` list with the task. @@ -4983,12 +4971,12 @@ paths: $ref: '#/paths/~1users/get/responses/401/content/application~1json/schema' examples: orgProvidedNotFound: - summary: The organization specified by org or orgID doesn't own the token passed in the header + summary: The org or orgID passed doesn't own the token passed in the header value: code: invalid message: 'failed to decode request body: organization not found' missingFluxError: - summary: The request body doesn't contain a Flux query + summary: Task in request body is missing Flux query value: code: invalid message: 'failed to decode request: missing flux' @@ -5002,6 +4990,24 @@ paths: application/json: schema: $ref: '#/paths/~1users/get/responses/401/content/application~1json/schema' + x-codeSamples: + - lang: Shell + label: 'cURL: create a task' + source: | + curl http://localhost:8086/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF '/tasks/{taskID}': get: operationId: GetTasksID @@ -5010,7 +5016,7 @@ paths: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). parameters: - $ref: '#/paths/~1ready/get/parameters/0' - in: path @@ -5018,9 +5024,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve. + description: The ID of the task to retrieve. responses: '200': description: Success. The response body contains the task. @@ -5088,27 +5092,21 @@ paths: - Tasks summary: Update a task description: | - Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), - and then cancels all scheduled runs of the task. + Updates a task and then cancels all scheduled runs of the task. - Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. + Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. - #### Related guides - - - [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/) - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) + To update a task, pass an object that contains the updated key-value pairs. + To activate or inactivate a task, set the `status` property. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. requestBody: - description: | - In the request body, provide the task properties to update. + description: An object that contains updated task properties to apply. required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' parameters: - $ref: '#/paths/~1ready/get/parameters/0' - in: path @@ -5116,9 +5114,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)to update. + description: The ID of the task to update. responses: '200': description: Success. The response body contains the updated task. @@ -5142,13 +5138,12 @@ paths: - Tasks summary: Delete a task description: | - Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a task and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status - to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: '#/paths/~1ready/get/parameters/0' - in: path @@ -5156,9 +5151,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete. + description: The ID of the task to delete. responses: '204': description: Success. The task and runs are deleted. Scheduled runs are canceled. @@ -5285,21 +5278,21 @@ components: dashboards: /api/v2/dashboards?org=myorg properties: self: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' secrets: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' buckets: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' tasks: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' dashboards: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -5345,22 +5338,22 @@ components: properties: labels: description: The URL to retrieve labels for this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: description: The URL to retrieve members that can read this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' org: description: The URL to retrieve parent organization for this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: description: The URL to retrieve owners that can read and write to this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' self: description: The URL for this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' write: description: The URL to write line protocol to this bucket. - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' id: readOnly: true type: string @@ -5442,7 +5435,7 @@ components: required: - everySeconds labels: - $ref: '#/components/schemas/Variable/properties/labels' + $ref: '#/components/schemas/Task/properties/labels' required: - name - retentionRules @@ -5592,10 +5585,10 @@ components: properties: self: readOnly: true - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' user: readOnly: true - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' Variable: type: object required: @@ -5630,9 +5623,7 @@ components: items: type: string labels: - type: array - items: - $ref: '#/paths/~1scrapers~1%7BscraperTargetID%7D~1labels/post/responses/201/content/application~1json/schema/properties/label' + $ref: '#/components/schemas/Task/properties/labels' arguments: type: object oneOf: @@ -5831,18 +5822,15 @@ components: organization: /api/v2/orgs/1 properties: self: - type: string - format: uri - readOnly: true - description: URI of resource. + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' owners: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' bucket: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' organization: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' ScraperTargetResponses: type: object properties: @@ -6228,33 +6216,31 @@ components: id: readOnly: true type: string - description: | - The resource ID that InfluxDB uses to uniquely identify the task. orgID: description: | - An organization ID. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Specifies the organization that owns the task. type: string org: description: | - An organization name. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Specifies the organization that owns the task. type: string name: description: The name of the task. type: string - description: - description: A description of the task. - type: string ownerID: description: | - A user ID. - Identifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the task. + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string + description: + description: A description of the task. + type: string status: type: string enum: @@ -6263,26 +6249,22 @@ components: description: | `inactive` cancels scheduled runs and prevents manual runs of the task. labels: - $ref: '#/components/schemas/Variable/properties/labels' + type: array + items: + $ref: '#/paths/~1scrapers~1%7BscraperTargetID%7D~1labels/post/responses/201/content/application~1json/schema/properties/label' authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to list authorizations. type: string flux: - description: | - Flux with [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) + description: The Flux script that the task executes. type: string - format: Flux + format: flux every: description: 'The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' type: string @@ -6290,7 +6272,6 @@ components: cron: description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' type: string - format: cron offset: description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' type: string @@ -6330,17 +6311,20 @@ components: logs: /api/v2/tasks/1/logs properties: self: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + type: string + format: uri + readOnly: true + description: URI of resource. owners: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' members: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' runs: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' logs: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' labels: - $ref: '#/components/schemas/ScraperTargetResponse/allOf/1/properties/links/properties/self' + $ref: '#/components/schemas/Task/properties/links/properties/self' required: - id - name @@ -6350,17 +6334,19 @@ components: type: object properties: orgID: - $ref: '#/components/schemas/Task/properties/orgID' + description: The ID of the organization that owns this Task. + type: string org: - $ref: '#/components/schemas/Task/properties/org' - name: - $ref: '#/components/schemas/Task/properties/name' - description: - $ref: '#/components/schemas/Task/properties/description' - flux: - $ref: '#/components/schemas/Task/properties/flux' + description: The name of the organization that owns this Task. + type: string status: $ref: '#/components/schemas/Task/properties/status' + flux: + description: The Flux script to run for this task. + type: string + description: + description: An optional description of the task. + type: string required: - flux TaskUpdateRequest: @@ -6369,17 +6355,23 @@ components: status: $ref: '#/components/schemas/Task/properties/status' flux: - $ref: '#/components/schemas/Task/properties/flux' + description: The Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/Task/properties/name' + description: Update the 'name' option in the flux script. + type: string every: - $ref: '#/components/schemas/Task/properties/every' + description: Update the 'every' option in the flux script. + type: string cron: - $ref: '#/components/schemas/Task/properties/cron' + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: '#/components/schemas/Task/properties/offset' + description: Update the 'offset' option in the flux script. + type: string description: - $ref: '#/components/schemas/Task/properties/description' + description: Update the description of the task. + type: string responses: null examples: AuthorizationPostRequest: @@ -6419,7 +6411,7 @@ components: summary: A task with Flux description: Sets the `flux` property with Flux task options and a query. value: - flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. securitySchemes: diff --git a/contracts/oss.json b/contracts/oss.json index c92cdcd14..08b1aebf4 100644 --- a/contracts/oss.json +++ b/contracts/oss.json @@ -8438,7 +8438,7 @@ "Tasks" ], "summary": "List runs for a task", - "description": "Lists runs for the specified [task]({{% INFLUXDB_DOCS_URL %}}/process-data/).\n\nTo limit which task runs are returned, pass query parameters in your request.\nIf you don't pass query parameters, InfluxDB returns all runs for the task\nup to the default `limit`.\n", + "description": "Retrieves a list of runs for a [task]({{% INFLUXDB_DOCS_URL %}}/process-data/).\n\nTo limit which task runs are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all task runs up to the default `limit`.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8450,7 +8450,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto list runs for.\n" + "description": "The ID of the task to get runs for.\nOnly returns runs for this task.\n" }, { "in": "query", @@ -8458,7 +8458,7 @@ "schema": { "type": "string" }, - "description": "A task run ID. Only returns runs created after the specified run." + "description": "A task run ID. Only returns runs created after this run." }, { "in": "query", @@ -8478,7 +8478,7 @@ "type": "string", "format": "date-time" }, - "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled after the specified time.\n" + "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled after this time.\n" }, { "in": "query", @@ -8487,7 +8487,7 @@ "type": "string", "format": "date-time" }, - "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled before the specified time.\n" + "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)).\nOnly returns runs scheduled before this time.\n" } ], "responses": { @@ -8519,7 +8519,7 @@ "Tasks" ], "summary": "Start a task run, overriding the schedule", - "description": "Schedules a task run to start immediately, ignoring scheduled runs.\n\nUse this endpoint to manually start a task run.\nScheduled runs will continue to run as scheduled.\nThis may result in concurrently running tasks.\n\nTo _retry_ a previous run (and avoid creating a new run),\nuse the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry).\n\n#### Limitations\n\n- Queuing a task run requires that the task's `status` property be set to `active`.\n", + "description": "Schedules a task run to start immediately, ignoring scheduled runs.\n\nUse this endpoint to manually start a task run.\nScheduled runs will continue to run as scheduled.\nThis may result in concurrently running tasks.\n\nTo _retry_ a previous run (and avoid creating a new run),\nuse the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8530,8 +8530,7 @@ "schema": { "type": "string" }, - "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto run.\n" + "required": true } ], "requestBody": { @@ -8554,25 +8553,6 @@ } } }, - "400": { - "description": "Bad request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "inactiveTask": { - "summary": "Can't run an inactive task", - "value": { - "code": "invalid", - "message": "failed to force run: inactive task" - } - } - } - } - } - }, "401": { "$ref": "#/components/responses/AuthorizationError" }, @@ -8592,7 +8572,7 @@ "Tasks" ], "summary": "Retrieve a run for a task.", - "description": "Retrieves the specified run for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to retrieve detail and logs for a specific task run.\n", + "description": "Retrieves a specific run for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to retrieve detail and logs for a specific task run.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8604,7 +8584,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nthat the task run belongs to.\n" + "description": "The ID of the task to retrieve runs for." }, { "in": "path", @@ -8613,7 +8593,7 @@ "type": "string" }, "required": true, - "description": "A task run ID. Specifies the run to retrieve." + "description": "The ID of the run to retrieve." } ], "responses": { @@ -8682,7 +8662,7 @@ "Tasks" ], "summary": "Cancel a running task", - "description": "Cancels a running [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to cancel a running task.\n\n#### InfluxDB Cloud\n\n- Doesn't support this operation.\n", + "description": "Cancels a running [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint with InfluxDB OSS to cancel a running task.\n\n#### InfluxDB Cloud\n\n- Doesn't support this operation.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8694,7 +8674,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to\nto cancel.\n" + "description": "The ID of the task to cancel." }, { "in": "path", @@ -8703,7 +8683,7 @@ "type": "string" }, "required": true, - "description": "A task run ID.\nSpecifies the task run to cancel.\n" + "description": "The ID of the task run to cancel." } ], "responses": { @@ -8745,7 +8725,7 @@ "Tasks" ], "summary": "Retry a task run", - "description": "Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to\nretry and then returns the scheduled run.\n\nTo manually start a _new_ task run, use the\n[`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns).\n\n#### Limitations\n\n- Queuing a task run requires that the task's `status` property be set to `active`.\n", + "description": "Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to\nretry and returns the scheduled run.\n\nTo manually start a _new_ task run, use the\n[`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns).\n\n#### Limitations\n\n- The task must be _active_ (`status: \"active\"`).\n", "requestBody": { "content": { "application/json; charset=utf-8": { @@ -8766,7 +8746,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the task run belongs to.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task to retry.\n" }, { "in": "path", @@ -8775,7 +8755,7 @@ "type": "string" }, "required": true, - "description": "A task run ID.\nSpecifies the task run to retry.\n\nTo find a task run ID, use the\n[`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns)\nto list task runs.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run ID.\nSpecifies the task run to retry.\n\nTo find a task run ID, use the\n[`GET /api/v2/tasks/{taskID}/runs` endpoint](#operation/GetTasksIDRuns)\nto list task runs.\n" } ], "responses": { @@ -8847,8 +8827,8 @@ "tags": [ "Tasks" ], - "summary": "List logs for a task", - "description": "Lists all log events for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nWhen a task runs, InfluxDB creates a `run` record in the task’s history.\nLogs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt.\n\nUse this endpoint to retrieve only the log events for a task,\nwithout additional task metadata.\n", + "summary": "Retrieve all logs for a task", + "description": "Retrieves a list of all logs for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nWhen an InfluxDB task runs, a “run” record is created in the task’s history.\nLogs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt.\n\nUse this endpoint to retrieve only the log events for a task,\nwithout additional task metadata.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8860,12 +8840,12 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve logs for." + "description": "The task ID." } ], "responses": { "200": { - "description": "Success.\nThe response body contains an `events` list with logs for the task.\nEach log event `message` contains detail about the event.\nIf a task run fails, InfluxDB logs an event with the reason for the failure.\n", + "description": "Success. The response body contains an `events` list with logs for the task.\nEach log event `message` contains detail about the event.\nIf a task run fails, InfluxDB logs an event with the reason for the failure.\n", "content": { "application/json": { "schema": { @@ -8873,7 +8853,7 @@ }, "examples": { "taskSuccess": { - "summary": "Events for a successful task run", + "summary": "Events for a successful task run.", "value": { "events": [ { @@ -8890,7 +8870,7 @@ } }, "taskFailure": { - "summary": "Events for a failed task run", + "summary": "Events for a failed task run.", "value": { "events": [ { @@ -8939,8 +8919,8 @@ "tags": [ "Tasks" ], - "summary": "List logs for a run", - "description": "Lists all logs for a task run.\nA log is a list of run events with `runID`, `time`, and `message` properties.\n\nUse this endpoint to help analyze [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) performance and troubleshoot failed task runs.\n", + "summary": "Retrieve all logs for a run", + "description": "Retrieves all logs for a task run.\nA log is a list of run events with `runID`, `time`, and `message` properties.\n\nUse this endpoint to help analyze task performance and troubleshoot failed task runs.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -8952,7 +8932,7 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the run belongs to." + "description": "The ID of the task to get logs for." }, { "in": "path", @@ -8961,7 +8941,7 @@ "type": "string" }, "required": true, - "description": "A run ID. Specifies the task run to list logs for." + "description": "The ID of the run to get logs for." } ], "responses": { @@ -9041,7 +9021,7 @@ "Tasks" ], "summary": "List labels for a task", - "description": "Lists all labels for a task.\n\nUse this endpoint to list labels applied to a task.\nLabels are a way to add metadata to InfluxDB resources.\nYou can use labels for grouping and filtering resources in the\nInfluxDB UI, `influx` CLI, and InfluxDB API.\n", + "description": "Retrieves a list of all labels for a task.\n\nLabels may be used for grouping and filtering tasks.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9053,7 +9033,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the task to retrieve labels for.\n" + "description": "The ID of the task to retrieve labels for." } ], "responses": { @@ -9090,7 +9070,7 @@ "Tasks" ], "summary": "Add a label to a task", - "description": "Adds a label to a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nUse this endpoint to add a label to a task.\nLabels are a way to add metadata to InfluxDB resources.\nYou can use labels for grouping and filtering resources in the\nInfluxDB UI, `influx` CLI, and InfluxDB API.\n", + "description": "Adds a label to a task.\n\nUse this endpoint to add a label that you can use to filter tasks in the InfluxDB UI.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9102,11 +9082,11 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to label.\n" + "description": "The ID of the task to label." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the label.\n", + "description": "An object that contains a _`labelID`_ to add to the task.", "required": true, "content": { "application/json": { @@ -9118,7 +9098,7 @@ }, "responses": { "201": { - "description": "Success. The response body contains the label.", + "description": "Success. The response body contains a list of all labels for the task.", "content": { "application/json": { "schema": { @@ -9152,7 +9132,7 @@ "Tasks" ], "summary": "Delete a label from a task", - "description": "Deletes a label from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "Deletes a label from a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9164,7 +9144,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete the label from.\n" + "description": "The ID of the task to delete the label from." }, { "in": "path", @@ -9173,7 +9153,7 @@ "type": "string" }, "required": true, - "description": "A label ID.\nSpecifies the label to delete.\n" + "description": "The ID of the label to delete." } ], "responses": { @@ -9346,7 +9326,7 @@ "Tasks" ], "summary": "List all task members", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nLists all users that have the `member` role for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9358,12 +9338,12 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve members for.\n" + "description": "The task ID." } ], "responses": { "200": { - "description": "Success. The response body contains a list of `users` that have\nthe `member` role for a task.\n\nIf the task has no members, the response contains an empty `users` array.\n", + "description": "Success. The response body contains a list of `users` that have\nthe `member` role for a task.\n", "content": { "application/json": { "schema": { @@ -9391,7 +9371,7 @@ "Tasks" ], "summary": "Add a member to a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a specified user to members of the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and then returns\nthe member.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9403,11 +9383,11 @@ "type": "string" }, "required": true, - "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nSpecifies the task for the member.\n" + "description": "The task ID." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the user.\n", + "description": "A user to add as a member of the task.", "required": true, "content": { "application/json": { @@ -9419,7 +9399,7 @@ }, "responses": { "201": { - "description": "Created. The task `member` role is assigned to the user.\nThe response body contains the resource member with\nrole and user detail.\n", + "description": "Created. The user is added to task members.", "content": { "application/json": { "schema": { @@ -9449,7 +9429,7 @@ "Tasks" ], "summary": "Remove a member from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRemoves a member from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9461,7 +9441,7 @@ "type": "string" }, "required": true, - "description": "A user ID. Specifies the member to remove." + "description": "The ID of the member to remove." }, { "in": "path", @@ -9470,12 +9450,12 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the member from." + "description": "The task ID." } ], "responses": { "204": { - "description": "Success. The member is removed." + "description": "Member removed" }, "default": { "description": "Unexpected error", @@ -9498,7 +9478,7 @@ "Tasks" ], "summary": "List all owners of a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nLists all users that have the `owner` role for the specified task.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9510,7 +9490,7 @@ "type": "string" }, "required": true, - "description": "A task ID. Specifies the task to retrieve owners for." + "description": "The ID of the task to retrieve owners for." } ], "responses": { @@ -9559,7 +9539,7 @@ "Tasks" ], "summary": "Add an owner for a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a specified user to owners of the specified task and then returns the\nowner.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9571,11 +9551,11 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) for the owner.\n" + "description": "The task ID." } ], "requestBody": { - "description": "In the request body, provide an object that specifies the user.\n", + "description": "A user to add as an owner of the task.", "required": true, "content": { "application/json": { @@ -9648,7 +9628,7 @@ "Tasks" ], "summary": "Remove an owner from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRemoves an owner from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9660,7 +9640,7 @@ "type": "string" }, "required": true, - "description": "A user ID. Specifies the owner to remove from the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)." + "description": "The ID of the owner to remove." }, { "in": "path", @@ -9669,12 +9649,12 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the owner from.\n" + "description": "The task ID." } ], "responses": { "204": { - "description": "Success. The owner is removed." + "description": "Owner removed" }, "default": { "description": "Unexpected error", @@ -15497,7 +15477,7 @@ "Tasks" ], "summary": "List tasks", - "description": "Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nTo limit which tasks are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all tasks up to the default `limit`.\n\n#### Related guide\n\n- [Process data with InfluxDB tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/)\n", + "description": "Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n\nTo limit which tasks are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all tasks up to the default `limit`.\n\n#### Related guide\n\n- [Process data with InfluxDB tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -15505,7 +15485,7 @@ { "in": "query", "name": "name", - "description": "A task name.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nthat have the specified name.\nDifferent tasks may have the same name.\n", + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name.\nOnly returns tasks with the specified name.\nDifferent tasks may have the same name.\n", "schema": { "type": "string" } @@ -15516,7 +15496,7 @@ "schema": { "type": "string" }, - "description": "A task ID.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID.\nOnly returns tasks created after the specified task.\n" }, { "in": "query", @@ -15524,7 +15504,7 @@ "schema": { "type": "string" }, - "description": "A user ID.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nowned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + "description": "A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID.\nOnly returns tasks owned by the specified user.\n" }, { "in": "query", @@ -15532,7 +15512,7 @@ "schema": { "type": "string" }, - "description": "An organization name.\nOnly returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name.\nOnly returns tasks owned by the specified organization.\n" }, { "in": "query", @@ -15540,7 +15520,7 @@ "schema": { "type": "string" }, - "description": "An organization ID.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID.\nOnly returns tasks owned by the specified organization.\n" }, { "in": "query", @@ -15552,7 +15532,7 @@ "inactive" ] }, - "description": "A task status.\nOnly returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status.\n" + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status.\nOnly returns tasks that have the specified status (`active` or `inactive`).\n" }, { "in": "query", @@ -15568,7 +15548,7 @@ { "in": "query", "name": "type", - "description": "A task type.\nSpecifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response.\nDefault is `system`.\nThe default (`system`) response contains all the metadata properties for tasks.\nTo reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`).\n", + "description": "A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`).\nDefault is `system`.\nSpecifies the level of detail for tasks in the response.\nThe default (`system`) response contains all the metadata properties for tasks.\nTo reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`).\n", "required": false, "schema": { "default": "", @@ -15685,24 +15665,19 @@ "Tasks" ], "summary": "Create a task", - "description": "Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task.\n\nUse this endpoint to create a scheduled task that runs a script.\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Create a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/)\n- [Common tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", + "description": "Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task.\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Create a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/)\n- [Common tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" } ], "requestBody": { - "description": "In the request body, provide the task.\n\n#### InfluxDB OSS\n\n- Requires either the `org` parameter or the `orgID` parameter.\n", + "description": "The task to create.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskCreateRequest" - }, - "examples": { - "TaskWithFlux": { - "$ref": "#/components/examples/TaskWithFluxRequest" - } } } } @@ -15727,14 +15702,14 @@ }, "examples": { "orgProvidedNotFound": { - "summary": "The organization specified by org or orgID doesn't own the token passed in the header", + "summary": "The org or orgID passed doesn't own the token passed in the header", "value": { "code": "invalid", "message": "failed to decode request body: organization not found" } }, "missingFluxError": { - "summary": "The request body doesn't contain a Flux query", + "summary": "Task in request body is missing Flux query", "value": { "code": "invalid", "message": "failed to decode request: missing flux" @@ -15760,7 +15735,14 @@ } } } - } + }, + "x-codeSamples": [ + { + "lang": "Shell", + "label": "cURL: create a task", + "source": "curl http://localhost:8086/api/v2/tasks \\\n --header \"Content-type: application/json\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\" \\\n --data-binary @- << EOF\n {\n \"orgID\": \"INFLUX_ORG_ID\",\n \"description\": \"IoT Center 30d environment average.\",\n \"flux\": \"option task = {name: \\\"iot-center-task-1\\\", every: 30m}\\\n from(bucket: \\\"iot_center\\\")\\\n |> range(start: -30d)\\\n |> filter(fn: (r) => r._measurement == \\\"environment\\\")\\\n |> aggregateWindow(every: 1h, fn: mean)\"\n }\nEOF\n" + } + ] } }, "/tasks/{taskID}": { @@ -15771,7 +15753,7 @@ "Tasks" ], "summary": "Retrieve a task", - "description": "Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", + "description": "Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -15783,7 +15765,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve.\n" + "description": "The ID of the task to retrieve." } ], "responses": { @@ -15820,19 +15802,14 @@ "Tasks" ], "summary": "Update a task", - "description": "Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task),\nand then cancels all scheduled runs of the task.\n\nUse this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`.\nOnce InfluxDB applies the update, it cancels all previously scheduled runs of the task.\n\n#### Related guides\n\n- [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/)\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", + "description": "Updates a task and then cancels all scheduled runs of the task.\n\nUse this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`).\nOnce InfluxDB applies the update, it cancels all previously scheduled runs of the task.\n\nTo update a task, pass an object that contains the updated key-value pairs.\nTo activate or inactivate a task, set the `status` property.\n_`\"status\": \"inactive\"`_ cancels scheduled runs and prevents manual runs of the task.\n", "requestBody": { - "description": "In the request body, provide the task properties to update.\n", + "description": "An object that contains updated task properties to apply.", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TaskUpdateRequest" - }, - "examples": { - "TaskWithFlux": { - "$ref": "#/components/examples/TaskWithFluxRequest" - } } } } @@ -15848,7 +15825,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)to update.\n" + "description": "The ID of the task to update." } ], "responses": { @@ -15885,7 +15862,7 @@ "Tasks" ], "summary": "Delete a task", - "description": "Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nand all associated records (task runs, logs, and labels).\nOnce the task is deleted, InfluxDB cancels all scheduled runs of the task.\n\nTo disable a task instead of delete it, use\n[`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status\n to `inactive`.\n", + "description": "Deletes a task and associated records.\n\nUse this endpoint to delete a task and all associated records (task runs, logs, and labels).\nOnce the task is deleted, InfluxDB cancels all scheduled runs of the task.\n\nIf you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID).\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -15897,7 +15874,7 @@ "type": "string" }, "required": true, - "description": "A task ID.\nSpecifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete.\n" + "description": "The ID of the task to delete." } ], "responses": { @@ -18964,42 +18941,6 @@ } } }, - "TaskCron": { - "description": "A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.", - "type": "string", - "format": "cron" - }, - "TaskDescription": { - "description": "A description of the task.", - "type": "string" - }, - "TaskEvery": { - "description": "The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.", - "type": "string", - "format": "duration" - }, - "TaskFlux": { - "description": "Flux with [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\nand the script for the task to run.\n\n#### Related guides\n\n- [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/)\n", - "type": "string", - "format": "Flux" - }, - "TaskName": { - "description": "The name of the task.", - "type": "string" - }, - "TaskOffset": { - "description": "A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.", - "type": "string", - "format": "duration" - }, - "TaskOrg": { - "description": "An organization name.\nIdentifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task.\n", - "type": "string" - }, - "TaskOrgID": { - "description": "An organization ID.\nIdentifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task.\n", - "type": "string" - }, "TaskStatusType": { "type": "string", "enum": [ @@ -24555,23 +24496,26 @@ "properties": { "id": { "readOnly": true, - "type": "string", - "description": "The resource ID that InfluxDB uses to uniquely identify the task.\n" + "type": "string" }, "orgID": { - "$ref": "#/components/schemas/TaskOrgID" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID.\nSpecifies the organization that owns the task.\n", + "type": "string" }, "org": { - "$ref": "#/components/schemas/TaskOrg" + "description": "An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name.\nSpecifies the organization that owns the task.\n", + "type": "string" }, "name": { - "$ref": "#/components/schemas/TaskName" - }, - "description": { - "$ref": "#/components/schemas/TaskDescription" + "description": "The name of the task.", + "type": "string" }, "ownerID": { - "description": "A user ID.\nIdentifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the task.\n\nTo find a user ID, use the\n[`GET /api/v2/users` endpoint](#operation/GetUsers) to\nlist users.\n", + "description": "A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID.\nSpecifies the owner of the task.\n\nTo find a user ID, you can use the\n[`GET /api/v2/users` endpoint](#operation/GetUsers) to\nlist users.\n", + "type": "string" + }, + "description": { + "description": "A description of the task.", "type": "string" }, "status": { @@ -24581,20 +24525,27 @@ "$ref": "#/components/schemas/Labels" }, "authorizationID": { - "description": "An authorization ID.\nIdentifies the authorization used when the task communicates with the query engine.\n\nTo find an authorization ID, use the\n[`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to\nlist authorizations.\n", + "description": "An authorization ID.\nSpecifies the authorization used when the task communicates with the query engine.\n\nTo find an authorization ID, use the\n[`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to\nlist authorizations.\n", "type": "string" }, "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": "The Flux script that the task executes.", + "type": "string", + "format": "flux" }, "every": { - "$ref": "#/components/schemas/TaskEvery" + "description": "The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.", + "type": "string", + "format": "duration" }, "cron": { - "$ref": "#/components/schemas/TaskCron" + "description": "A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.", + "type": "string" }, "offset": { - "$ref": "#/components/schemas/TaskOffset" + "description": "A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.", + "type": "string", + "format": "duration" }, "latestCompleted": { "description": "A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.", @@ -24669,22 +24620,23 @@ "type": "object", "properties": { "orgID": { - "$ref": "#/components/schemas/TaskOrgID" + "description": "The ID of the organization that owns this Task.", + "type": "string" }, "org": { - "$ref": "#/components/schemas/TaskOrg" - }, - "name": { - "$ref": "#/components/schemas/TaskName" + "description": "The name of the organization that owns this Task.", + "type": "string" }, - "description": { - "$ref": "#/components/schemas/TaskDescription" + "status": { + "$ref": "#/components/schemas/TaskStatusType" }, "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": "The Flux script to run for this task.", + "type": "string" }, - "status": { - "$ref": "#/components/schemas/TaskStatusType" + "description": { + "description": "An optional description of the task.", + "type": "string" } }, "required": [ @@ -24698,22 +24650,28 @@ "$ref": "#/components/schemas/TaskStatusType" }, "flux": { - "$ref": "#/components/schemas/TaskFlux" + "description": "The Flux script that the task runs.", + "type": "string" }, "name": { - "$ref": "#/components/schemas/TaskName" + "description": "Update the 'name' option in the flux script.", + "type": "string" }, "every": { - "$ref": "#/components/schemas/TaskEvery" + "description": "Update the 'every' option in the flux script.", + "type": "string" }, "cron": { - "$ref": "#/components/schemas/TaskCron" + "description": "Update the 'cron' option in the flux script.", + "type": "string" }, "offset": { - "$ref": "#/components/schemas/TaskOffset" + "description": "Update the 'offset' option in the flux script.", + "type": "string" }, "description": { - "$ref": "#/components/schemas/TaskDescription" + "description": "Update the description of the task.", + "type": "string" } } } @@ -24881,7 +24839,7 @@ "summary": "A task with Flux", "description": "Sets the `flux` property with Flux task options and a query.", "value": { - "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", "status": "active", "description": "This task contains Flux that configures the task schedule and downsamples CPU data every hour." } diff --git a/contracts/oss.yml b/contracts/oss.yml index 2c707f519..0dae355a6 100644 --- a/contracts/oss.yml +++ b/contracts/oss.yml @@ -7204,11 +7204,10 @@ paths: - Tasks summary: List runs for a task description: | - Lists runs for the specified [task](https://docs.influxdata.com/influxdb/latest/process-data/). + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/latest/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7217,14 +7216,13 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. - in: query name: after schema: type: string - description: A task run ID. Only returns runs created after the specified run. + description: A task run ID. Only returns runs created after this run. - in: query name: limit schema: @@ -7241,7 +7239,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. - in: query name: beforeTime schema: @@ -7249,7 +7247,7 @@ paths: format: date-time description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. responses: '200': description: Success. The response body contains the list of task runs. @@ -7278,10 +7276,6 @@ paths: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7289,10 +7283,6 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to run. requestBody: content: application/json: @@ -7305,18 +7295,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Run' - '400': - description: Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - inactiveTask: - summary: Can't run an inactive task - value: - code: invalid - message: 'failed to force run: inactive task' '401': $ref: '#/components/responses/AuthorizationError' '500': @@ -7330,7 +7308,7 @@ paths: - Tasks summary: Retrieve a run for a task. description: | - Retrieves the specified run for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. parameters: @@ -7340,16 +7318,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that the task run belongs to. + description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true - description: A task run ID. Specifies the run to retrieve. + description: The ID of the run to retrieve. responses: '200': description: Success. The response body contains the task run. @@ -7398,7 +7373,7 @@ paths: description: | Cancels a running [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -7410,18 +7385,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to cancel. + description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true - description: | - A task run ID. - Specifies the task run to cancel. + description: The ID of the task run to cancel. responses: '204': description: | @@ -7463,15 +7433,15 @@ paths: - Tasks summary: Retry a task run description: | - Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). requestBody: content: application/json; charset=utf-8: @@ -7485,15 +7455,15 @@ paths: type: string required: true description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the task run belongs to. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. + Specifies the task to retry. - in: path name: runID schema: type: string required: true description: | - A task run ID. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the @@ -7551,12 +7521,12 @@ paths: operationId: GetTasksIDLogs tags: - Tasks - summary: List logs for a task + summary: Retrieve all logs for a task description: | - Lists all log events for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. @@ -7567,12 +7537,11 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve logs for.' + description: The task ID. responses: '200': description: | - Success. - The response body contains an `events` list with logs for the task. + Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. content: @@ -7581,7 +7550,7 @@ paths: $ref: '#/components/schemas/Logs' examples: taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: events: - runID: 09b070dadaa7d000 @@ -7591,7 +7560,7 @@ paths: time: '2022-07-18T14:46:07.242859Z' message: Completed(success) taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: events: - runID: 09a946fc3167d000 @@ -7618,12 +7587,12 @@ paths: operationId: GetTasksIDRunsIDLogs tags: - Tasks - summary: List logs for a run + summary: Retrieve all logs for a run description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7631,13 +7600,13 @@ paths: schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the run belongs to.' + description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true - description: A run ID. Specifies the task run to list logs for. + description: The ID of the run to get logs for. responses: '200': description: | @@ -7689,12 +7658,9 @@ paths: - Tasks summary: List labels for a task description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7702,9 +7668,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the task to retrieve labels for. + description: The ID of the task to retrieve labels for. responses: '200': description: Success. The response body contains a list of all labels for the task. @@ -7728,12 +7692,9 @@ paths: - Tasks summary: Add a label to a task description: | - Adds a label to a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7741,12 +7702,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to label. + description: The ID of the task to label. requestBody: - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: @@ -7754,7 +7712,7 @@ paths: $ref: '#/components/schemas/LabelMapping' responses: '201': - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: @@ -7776,7 +7734,7 @@ paths: - Tasks summary: Delete a label from a task description: | - Deletes a label from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Deletes a label from a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7784,17 +7742,13 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to delete the label from. + description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true - description: | - A label ID. - Specifies the label to delete. + description: The ID of the label to delete. responses: '204': description: Success. The label is deleted. @@ -7965,9 +7919,7 @@ paths: summary: List all task members description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7975,16 +7927,12 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve members for. + description: The task ID. responses: '200': description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. content: application/json: schema: @@ -8005,8 +7953,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8014,12 +7961,9 @@ paths: schema: type: string required: true - description: | - A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. - Specifies the task for the member. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true content: application/json: @@ -8027,10 +7971,7 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. content: application/json: schema: @@ -8050,9 +7991,7 @@ paths: summary: Remove a member from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8060,16 +7999,16 @@ paths: schema: type: string required: true - description: A user ID. Specifies the member to remove. + description: The ID of the member to remove. - in: path name: taskID schema: type: string required: true - description: 'A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to remove the member from.' + description: The task ID. responses: '204': - description: Success. The member is removed. + description: Member removed default: description: Unexpected error content: @@ -8087,7 +8026,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8095,7 +8034,7 @@ paths: schema: type: string required: true - description: A task ID. Specifies the task to retrieve owners for. + description: The ID of the task to retrieve owners for. responses: '200': description: | @@ -8139,8 +8078,7 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. @@ -8151,12 +8089,9 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) for the owner. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true content: application/json: @@ -8215,8 +8150,6 @@ paths: description: | **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes an owner from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8224,18 +8157,16 @@ paths: schema: type: string required: true - description: 'A user ID. Specifies the owner to remove from the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task).' + description: The ID of the owner to remove. - in: path name: taskID schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to remove the owner from. + description: The task ID. responses: '204': - description: Success. The owner is removed. + description: Owner removed default: description: Unexpected error content: @@ -12466,7 +12397,7 @@ paths: - Tasks summary: List tasks description: | - Lists [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -12479,9 +12410,8 @@ paths: - in: query name: name description: | - A task name. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that have the specified name. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -12490,30 +12420,29 @@ paths: schema: type: string description: | - A task ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) created after the specified task. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - owned by the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). + A [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns tasks owned by the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) owned by the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -12522,8 +12451,8 @@ paths: - active - inactive description: | - A task status. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that have the specified status. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -12541,9 +12470,9 @@ paths: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) in the response. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) type (`basic` or `system`). Default is `system`. + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false @@ -12647,9 +12576,7 @@ paths: - Tasks summary: Create a task description: | - Creates a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. - - Use this endpoint to create a scheduled task that runs a script. + Creates a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. #### Related guides @@ -12660,20 +12587,12 @@ paths: parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: | - In the request body, provide the task. - - #### InfluxDB OSS - - - Requires either the `org` parameter or the `orgID` parameter. + description: The task to create. required: true content: application/json: schema: $ref: '#/components/schemas/TaskCreateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' responses: '201': description: Success. The response body contains a `tasks` list with the task. @@ -12695,12 +12614,12 @@ paths: $ref: '#/components/schemas/Error' examples: orgProvidedNotFound: - summary: The organization specified by org or orgID doesn't own the token passed in the header + summary: The org or orgID passed doesn't own the token passed in the header value: code: invalid message: 'failed to decode request body: organization not found' missingFluxError: - summary: The request body doesn't contain a Flux query + summary: Task in request body is missing Flux query value: code: invalid message: 'failed to decode request: missing flux' @@ -12714,6 +12633,24 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: 'cURL: create a task' + source: | + curl http://localhost:8086/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF '/tasks/{taskID}': get: operationId: GetTasksID @@ -12722,7 +12659,7 @@ paths: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -12730,9 +12667,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve. + description: The ID of the task to retrieve. responses: '200': description: Success. The response body contains the task. @@ -12756,27 +12691,21 @@ paths: - Tasks summary: Update a task description: | - Updates the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task), - and then cancels all scheduled runs of the task. + Updates a task and then cancels all scheduled runs of the task. - Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. + Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. - #### Related guides - - - [Update a task](https://docs.influxdata.com/influxdb/latest/process-data/manage-tasks/update-task/) - - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) + To update a task, pass an object that contains the updated key-value pairs. + To activate or inactivate a task, set the `status` property. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. requestBody: - description: | - In the request body, provide the task properties to update. + description: An object that contains updated task properties to apply. required: true content: application/json: schema: $ref: '#/components/schemas/TaskUpdateRequest' - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -12784,9 +12713,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task)to update. + description: The ID of the task to update. responses: '200': description: Success. The response body contains the updated task. @@ -12810,13 +12737,12 @@ paths: - Tasks summary: Delete a task description: | - Deletes the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a task and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status - to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -12824,9 +12750,7 @@ paths: schema: type: string required: true - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to delete. + description: The ID of the task to delete. responses: '204': description: Success. The task and runs are deleted. Scheduled runs are canceled. @@ -15169,44 +15093,6 @@ components: Default is the server _now_ time. type: string format: date-time - TaskCron: - description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' - type: string - format: cron - TaskDescription: - description: A description of the task. - type: string - TaskEvery: - description: 'The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' - type: string - format: duration - TaskFlux: - description: | - Flux with [task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - type: string - format: Flux - TaskName: - description: The name of the task. - type: string - TaskOffset: - description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' - type: string - format: duration - TaskOrg: - description: | - An organization name. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string - TaskOrgID: - description: | - An organization ID. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string TaskStatusType: type: string enum: @@ -19065,25 +18951,31 @@ components: id: readOnly: true type: string - description: | - The resource ID that InfluxDB uses to uniquely identify the task. orgID: - $ref: '#/components/schemas/TaskOrgID' + description: | + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: | + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string name: - $ref: '#/components/schemas/TaskName' - description: - $ref: '#/components/schemas/TaskDescription' + description: The name of the task. + type: string ownerID: description: | - A user ID. - Identifies the [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) that owns the task. + A [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string + description: + description: A description of the task. + type: string status: $ref: '#/components/schemas/TaskStatusType' labels: @@ -19091,20 +18983,27 @@ components: authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to list authorizations. type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: The Flux script that the task executes. + type: string + format: flux every: - $ref: '#/components/schemas/TaskEvery' + description: 'The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' + type: string + format: duration cron: - $ref: '#/components/schemas/TaskCron' + description: 'A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB uses the system time when evaluating Cron expressions.' + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' + type: string + format: duration latestCompleted: description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.' type: string @@ -19160,17 +19059,19 @@ components: type: object properties: orgID: - $ref: '#/components/schemas/TaskOrgID' + description: The ID of the organization that owns this Task. + type: string org: - $ref: '#/components/schemas/TaskOrg' - name: - $ref: '#/components/schemas/TaskName' - description: - $ref: '#/components/schemas/TaskDescription' - flux: - $ref: '#/components/schemas/TaskFlux' + description: The name of the organization that owns this Task. + type: string status: $ref: '#/components/schemas/TaskStatusType' + flux: + description: The Flux script to run for this task. + type: string + description: + description: An optional description of the task. + type: string required: - flux TaskUpdateRequest: @@ -19179,17 +19080,23 @@ components: status: $ref: '#/components/schemas/TaskStatusType' flux: - $ref: '#/components/schemas/TaskFlux' + description: The Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/TaskName' + description: Update the 'name' option in the flux script. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: Update the 'every' option in the flux script. + type: string cron: - $ref: '#/components/schemas/TaskCron' + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: Update the 'offset' option in the flux script. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: Update the description of the task. + type: string responses: AuthorizationError: description: | @@ -19319,7 +19226,7 @@ components: summary: A task with Flux description: Sets the `flux` property with Flux task options and a query. value: - flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. securitySchemes: diff --git a/contracts/ref/cloud.yml b/contracts/ref/cloud.yml index ce19d6d1d..40abc74fd 100644 --- a/contracts/ref/cloud.yml +++ b/contracts/ref/cloud.yml @@ -40,10 +40,10 @@ components: description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: - \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == - \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: - (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> - to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement + == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> + filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, + fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active TaskWithScriptRequest: description: | @@ -4821,7 +4821,7 @@ components: authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to @@ -4832,16 +4832,28 @@ components: readOnly: true type: string cron: - $ref: '#/components/schemas/TaskCron' + description: A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) + that defines the schedule on which the task runs. InfluxDB uses the system + time when evaluating Cron expressions. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: A description of the task. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: The interval ([duration literal](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) + at which the task runs. `every` also determines when the task first runs, + depending on the specified time. + format: duration + type: string flux: - $ref: '#/components/schemas/TaskFlux' - id: description: | - The resource ID that InfluxDB uses to uniquely identify the task. + The Flux script that the task executes. + + #### Limitations + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + format: flux + type: string + id: readOnly: true type: string labels: @@ -4886,26 +4898,58 @@ components: readOnly: true type: object name: - $ref: '#/components/schemas/TaskName' + description: The name of the task. + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) + to delay execution of the task after the scheduled time has elapsed. `0` + removes the offset. + format: duration + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: | + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string orgID: - $ref: '#/components/schemas/TaskOrgID' + description: | + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string ownerID: description: | - A user ID. - Identifies the [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) that owns the task. + A [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: | + A script ID. + Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes. + + #### Limitations + + - If you use the `scriptID` property, you can't use the `flux` property. + + #### Related guides + + - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: | + Key-value pairs for `params` in the script. + Defines the invocation parameter values passed to the script specified by `scriptID`. + When running the task, InfluxDB executes the script with the parameters + you provide. + + #### Limitations + + - To use `scriptParameters`, you must provide a `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object status: $ref: '#/components/schemas/TaskStatusType' updatedAt: @@ -4920,97 +4964,60 @@ components: TaskCreateRequest: properties: cron: - $ref: '#/components/schemas/TaskCron' + description: A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) + that defines the schedule on which the task runs. InfluxDB bases cron + runs on the system time. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: The description of the task. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: | + The interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: | + The Flux script that the task runs. + + #### Limitations + + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string name: - $ref: '#/components/schemas/TaskName' + description: The name of the task + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) + to delay execution of the task after the scheduled time has elapsed. `0` + removes the offset. + format: duration + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: The name of the organization that owns the task. + type: string orgID: - $ref: '#/components/schemas/TaskOrgID' + description: The ID of the organization that owns the task. + type: string scriptID: - $ref: '#/components/schemas/TaskScriptID' - scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' - status: - $ref: '#/components/schemas/TaskStatusType' - type: object - TaskCron: - description: A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) - that defines the schedule on which the task runs. InfluxDB uses the system - time when evaluating Cron expressions. - format: cron - type: string - TaskDescription: - description: A description of the task. - type: string - TaskEvery: - description: The interval ([duration literal](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)) - at which the task runs. `every` also determines when the task first runs, - depending on the specified time. - format: duration - type: string - TaskFlux: - description: | - Flux with [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - format: Flux - type: string - TaskName: - description: The name of the task. - type: string - TaskOffset: - description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) - to delay execution of the task after the scheduled time has elapsed. `0` removes - the offset. - format: duration - type: string - TaskOrg: - description: | - An organization name. - Identifies the [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) that owns the task. - type: string - TaskOrgID: - description: | - An organization ID. - Identifies the [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) that owns the task. - type: string - TaskScriptID: - description: | - A script ID. - Identifies the [invokable script](#tag/Invokable-Scripts) that the task runs. - - #### Related guides - - - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: string - TaskScriptParameters: - description: | - Key-value pairs for `params` in the script. - Defines the invocation parameter values passed to the [invokable script](#tag/Invokable-Scripts) specified - by the `scriptID` property. - When running the task, InfluxDB executes the script with the parameters - you provide. + description: | + The ID of the script that the task runs. - #### Limitations + #### Limitations - - To use the `scriptParameters` property, you must also set the `scriptID` property - for the task. + - If you use the `scriptID` property, you can't use the `flux` property. + type: string + scriptParameters: + description: | + The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run. - #### Related guides + #### Limitations - - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). + - `scriptParameters` requires `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object + status: + $ref: '#/components/schemas/TaskStatusType' type: object TaskStatusType: description: | @@ -5022,21 +5029,29 @@ components: TaskUpdateRequest: properties: cron: - $ref: '#/components/schemas/TaskCron' + description: Update the 'cron' option in the flux script. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: Update the description of the task. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: Update the 'every' option in the flux script. + type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: Update the Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/TaskName' + description: Update the 'name' option in the flux script. + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: Update the 'offset' option in the flux script. + type: string scriptID: - $ref: '#/components/schemas/TaskScriptID' + description: Update the 'scriptID' of the task. + type: string scriptParameters: - $ref: '#/components/schemas/TaskScriptParameters' + description: Update the 'scriptParameters' of the task. + type: object status: $ref: '#/components/schemas/TaskStatusType' type: object @@ -15254,56 +15269,52 @@ paths: /api/v2/tasks: get: description: | - Lists [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. - - #### Related guide - - - [Process data with InfluxDB tasks](https://docs.influxdata.com/influxdb/cloud/process-data/) operationId: GetTasks parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task name. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) with the specified name. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. in: query name: name schema: type: string - description: | - A task ID. - Only returns [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) created after the specified task. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Only returns tasks created after the specified task. in: query name: after schema: type: string - description: | - A user ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) owned by the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + A [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. in: query name: user schema: type: string - description: | - An organization name. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) owned by the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. in: query name: org schema: type: string - description: | - An organization ID. - Only returns tasks owned by the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. in: query name: orgID schema: type: string - description: | - A task status. - Only returns [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) that have the specified status. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). in: query name: status schema: @@ -15341,11 +15352,8 @@ paths: minimum: 0 type: integer - description: | - The sort field. - Specifies the task property used to sort records in the list. - Default is `name`. - - The parameter has one supported value: `name`. + The sort field. Only `name` is supported. + Specifies the field used to sort records in the list. in: query name: sortBy required: false @@ -15354,13 +15362,11 @@ paths: - name type: string - description: | - A task type. - Specifies the level of detail for [tasks](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) in the response. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) type (`basic` or `system`). Default is `system`. - + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. - To reduce the response size, set the `type` parameter to `basic` (`type=basic`) - to omit some task properties (`flux`, `createdAt`, `updatedAt`). + To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). in: query name: type required: false @@ -15371,8 +15377,8 @@ paths: - system type: string - description: | - A script ID. - Only returns tasks that use the specified [invokable script](#tag/Invokable-Scripts). + A [script](#tag/Invokable-Scripts) ID. + Only returns tasks that use the specified invokable script. in: query name: scriptID schema: @@ -15457,7 +15463,7 @@ paths: $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' - summary: List tasks + summary: List all tasks tags: - Data I/O endpoints - Tasks @@ -15472,7 +15478,52 @@ paths: description: | Creates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and returns the task. - Use this endpoint to create a scheduled task that runs a script. + Use this endpoint to create a scheduled task that runs a Flux script. + + #### InfluxDB Cloud + + - You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -15486,35 +15537,9 @@ paths: requestBody: content: application/json: - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' schema: $ref: '#/components/schemas/TaskCreateRequest' - description: | - In the request body, provide the task. - - Set one of the following properties to provide the script that the task runs: - - `flux` - - `scriptID` - - If you set the `scriptID` property, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, you must provide the `task` configuration option - in the Flux script. - - See [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't use `flux` and `scriptID` in the same task. + description: The task to create required: true responses: "201": @@ -15523,7 +15548,7 @@ paths: schema: $ref: '#/components/schemas/Task' description: Success. The response body contains a `tasks` list with the - task. + new task. "400": content: application/json: @@ -15548,10 +15573,8 @@ paths: #### InfluxDB Cloud - - Returns this error if the task doesn't contain the `flux` property - or the `scriptID` property. - - Returns this error if the task contains `flux` _and_ `scriptID` - properties. + - Returns this error if the task doesn't contain one of _`flux`_ or _`scriptID`_. + - Returns this error if the task contains _`flux`_ _and_ _`scriptID`_. "401": $ref: '#/components/responses/AuthorizationError' "500": @@ -15566,22 +15589,58 @@ paths: tags: - Data I/O endpoints - Tasks + x-codeSamples: + - label: 'cURL: create a Flux script task' + lang: Shell + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF + - label: 'cURL: create a Flux script reference task' + lang: Shell + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "scriptID": "085138a111448000", + "scriptParameters": + { + "rangeStart": "-30d", + "bucket": "air_sensor", + "filterField": "temperature", + "groupColumn": "_time" + } + } + EOF /api/v2/tasks/{taskID}: delete: description: | - Deletes the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task's `status` - property to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). operationId: DeleteTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to delete. + - description: A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) + ID. Specifies the task to delete. in: path name: taskID required: true @@ -15606,13 +15665,13 @@ paths: - Tasks get: description: | - Retrieves the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). operationId: GetTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to retrieve. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to retrieve. in: path name: taskID required: true @@ -15641,25 +15700,66 @@ paths: - Tasks patch: description: | - Updates the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task), + Updates a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. + To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. - The `status` property set to `inactive` cancels scheduled runs and prevents manual runs of the task. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. - #### Related guides + #### InfluxDB Cloud - - [Update a task](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/update-task/) - - [Task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) + - Use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. operationId: PatchTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to update. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to update. in: path name: taskID required: true @@ -15668,35 +15768,9 @@ paths: requestBody: content: application/json: - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' - TaskWithScriptID: - $ref: '#/components/examples/TaskWithScriptRequest' schema: $ref: '#/components/schemas/TaskUpdateRequest' - description: | - In the request body, provide the task properties to update. - To provide the script that the task runs, - set either the `flux` property or the `scriptID` property. - - If you set `scriptID`, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, provide the `task` configuration option - in the Flux script. - - See [task configuration options](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't set `flux` and `scriptID` properties for the same task--for - example, if you set the `scriptID` property, then InfluxDB sets the `flux` property - to an empty string (`""`). + description: An task update to apply. required: true responses: "200": @@ -15721,18 +15795,13 @@ paths: /api/v2/tasks/{taskID}/labels: get: description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. operationId: GetTasksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the task to retrieve labels for. + - description: The ID of the task to retrieve labels for. in: path name: taskID required: true @@ -15761,18 +15830,13 @@ paths: - Tasks post: description: | - Adds a label to a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. operationId: PostTasksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to label. + - description: The ID of the task to label. in: path name: taskID required: true @@ -15783,8 +15847,7 @@ paths: application/json: schema: $ref: '#/components/schemas/LabelMapping' - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true responses: "201": @@ -15792,7 +15855,8 @@ paths: application/json: schema: $ref: '#/components/schemas/LabelResponse' - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for + the task. "400": $ref: '#/components/responses/BadRequestError' "401": @@ -15809,21 +15873,17 @@ paths: /api/v2/tasks/{taskID}/labels/{labelID}: delete: description: | - Deletes a label from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Deletes a label from a task. operationId: DeleteTasksIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to delete the label from. + - description: The ID of the task to delete the label from. in: path name: taskID required: true schema: type: string - - description: | - A label ID. - Specifies the label to delete. + - description: The ID of the label to delete. in: path name: labelID required: true @@ -15848,18 +15908,17 @@ paths: /api/v2/tasks/{taskID}/logs: get: description: | - Lists all log events for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. operationId: GetTasksIDLogs parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - to retrieve logs for. + - description: The task ID. in: path name: taskID required: true @@ -15871,7 +15930,7 @@ paths: application/json: examples: taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: events: - message: 'Started task from script: "option task = {name: \"test @@ -15888,7 +15947,7 @@ paths: runID: 09a946fc3167d000 time: "2022-07-13T08:24:37.115323Z" taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: events: - message: 'Started task from script: "option task = {name: \"task1\", @@ -15903,8 +15962,7 @@ paths: schema: $ref: '#/components/schemas/Logs' description: | - Success. - The response body contains an `events` list with logs for the task. + Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. "400": @@ -15917,7 +15975,7 @@ paths: $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' - summary: List logs for a task + summary: Retrieve all logs for a task tags: - Tasks /api/v2/tasks/{taskID}/members: @@ -15925,15 +15983,11 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: GetTasksIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to retrieve members for. + - description: The task ID. in: path name: taskID required: true @@ -15948,8 +16002,6 @@ paths: description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. default: content: application/json: @@ -15965,14 +16017,11 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. operationId: PostTasksIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. - Specifies the task for the member. + - description: The task ID. in: path name: taskID required: true @@ -15983,8 +16032,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true responses: "201": @@ -15992,10 +16040,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceMember' - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. default: content: application/json: @@ -16010,20 +16055,17 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: DeleteTasksIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A user ID. Specifies the member to remove. + - description: The ID of the member to remove. in: path name: userID required: true schema: type: string - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - to remove the member from. + - description: The task ID. in: path name: taskID required: true @@ -16031,7 +16073,7 @@ paths: type: string responses: "204": - description: Success. The member is removed. + description: Member removed default: content: application/json: @@ -16048,11 +16090,11 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. operationId: GetTasksIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the task to retrieve owners for. + - description: The ID of the task to retrieve owners for. in: path name: taskID required: true @@ -16100,17 +16142,14 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. operationId: PostTasksIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) for the owner. + - description: The task ID. in: path name: taskID required: true @@ -16121,8 +16160,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true responses: "201": @@ -16176,20 +16214,16 @@ paths: description: | **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes an owner from a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). operationId: DeleteTasksIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A user ID. Specifies the owner to remove from the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + - description: The ID of the owner to remove. in: path name: userID required: true schema: type: string - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to remove the owner from. + - description: The task ID. in: path name: taskID required: true @@ -16197,7 +16231,7 @@ paths: type: string responses: "204": - description: Success. The owner is removed. + description: Owner removed default: content: application/json: @@ -16210,25 +16244,22 @@ paths: /api/v2/tasks/{taskID}/runs: get: description: | - Lists runs for the specified [task](https://docs.influxdata.com/influxdb/cloud/process-data/). + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/cloud/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. operationId: GetTasksIDRuns parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. in: path name: taskID required: true schema: type: string - - description: A task run ID. Only returns runs created after the specified - run. + - description: A task run ID. Only returns runs created after this run. in: query name: after schema: @@ -16244,7 +16275,7 @@ paths: type: integer - description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. in: query name: afterTime schema: @@ -16252,7 +16283,7 @@ paths: type: string - description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. in: query name: beforeTime schema: @@ -16284,18 +16315,10 @@ paths: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. operationId: PostTasksIDRuns parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to run. - in: path + - in: path name: taskID required: true schema: @@ -16312,18 +16335,6 @@ paths: schema: $ref: '#/components/schemas/Run' description: Success. The run is scheduled to start. - "400": - content: - application/json: - examples: - inactiveTask: - summary: Can't run an inactive task - value: - code: invalid - message: 'failed to force run: inactive task' - schema: - $ref: '#/components/schemas/Error' - description: Bad request. "401": $ref: '#/components/responses/AuthorizationError' "500": @@ -16339,7 +16350,7 @@ paths: description: | Cancels a running [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -16347,18 +16358,13 @@ paths: operationId: DeleteTasksIDRunsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) to - to cancel. + - description: The ID of the task to cancel. in: path name: taskID required: true schema: type: string - - description: | - A task run ID. - Specifies the task run to cancel. + - description: The ID of the task run to cancel. in: path name: runID required: true @@ -16403,22 +16409,19 @@ paths: - Tasks get: description: | - Retrieves the specified run for the specified [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. operationId: GetTasksIDRunsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - that the task run belongs to. + - description: The ID of the task to retrieve runs for. in: path name: taskID required: true schema: type: string - - description: A task run ID. Specifies the run to retrieve. + - description: The ID of the run to retrieve. in: path name: runID required: true @@ -16473,21 +16476,20 @@ paths: /api/v2/tasks/{taskID}/runs/{runID}/logs: get: description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. operationId: GetTasksIDRunsIDLogs parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) - that the run belongs to. + - description: The ID of the task to get logs for. in: path name: taskID required: true schema: type: string - - description: A run ID. Specifies the task run to list logs for. + - description: The ID of the run to get logs for. in: path name: runID required: true @@ -16544,34 +16546,34 @@ paths: $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' - summary: List logs for a run + summary: Retrieve all logs for a run tags: - Tasks /api/v2/tasks/{taskID}/runs/{runID}/retry: post: description: | - Queues a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). operationId: PostTasksIDRunsIDRetry parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) that the task run belongs to. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) ID. + Specifies the task to retry. in: path name: taskID required: true schema: type: string - description: | - A task run ID. + A [task](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the diff --git a/contracts/ref/oss.yml b/contracts/ref/oss.yml index 50ba67a64..83cff1b74 100644 --- a/contracts/ref/oss.yml +++ b/contracts/ref/oss.yml @@ -40,10 +40,10 @@ components: description: This task contains Flux that configures the task schedule and downsamples CPU data every hour. flux: "option task = {name: \"CPU Total 1 Hour New\", every: 1h}from(bucket: - \"telegraf\")|> range(start: -1h)|> filter(fn: (r) => (r._measurement == - \"cpu\"))|> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))|> filter(fn: - (r) => (r.cpu == \"cpu-total\"))|> aggregateWindow(every: 1h, fn: max)|> - to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" + \"telegraf\") |> range(start: -1h) |> filter(fn: (r) => (r._measurement + == \"cpu\")) |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) |> + filter(fn: (r) => (r.cpu == \"cpu-total\")) |> aggregateWindow(every: 1h, + fn: max) |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")" status: active parameters: After: @@ -4917,7 +4917,7 @@ components: authorizationID: description: | An authorization ID. - Identifies the authorization used when the task communicates with the query engine. + Specifies the authorization used when the task communicates with the query engine. To find an authorization ID, use the [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to @@ -4928,16 +4928,24 @@ components: readOnly: true type: string cron: - $ref: '#/components/schemas/TaskCron' + description: A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) + that defines the schedule on which the task runs. InfluxDB uses the system + time when evaluating Cron expressions. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: A description of the task. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) + at which the task runs. `every` also determines when the task first runs, + depending on the specified time. + format: duration + type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: The Flux script that the task executes. + format: flux + type: string id: - description: | - The resource ID that InfluxDB uses to uniquely identify the task. readOnly: true type: string labels: @@ -4982,19 +4990,30 @@ components: readOnly: true type: object name: - $ref: '#/components/schemas/TaskName' + description: The name of the task. + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) + to delay execution of the task after the scheduled time has elapsed. `0` + removes the offset. + format: duration + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: | + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string orgID: - $ref: '#/components/schemas/TaskOrgID' + description: | + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string ownerID: description: | - A user ID. - Identifies the [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) that owns the task. + A [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) ID. + Specifies the owner of the task. - To find a user ID, use the + To find a user ID, you can use the [`GET /api/v2/users` endpoint](#operation/GetUsers) to list users. type: string @@ -5013,64 +5032,22 @@ components: TaskCreateRequest: properties: description: - $ref: '#/components/schemas/TaskDescription' + description: An optional description of the task. + type: string flux: - $ref: '#/components/schemas/TaskFlux' - name: - $ref: '#/components/schemas/TaskName' + description: The Flux script to run for this task. + type: string org: - $ref: '#/components/schemas/TaskOrg' + description: The name of the organization that owns this Task. + type: string orgID: - $ref: '#/components/schemas/TaskOrgID' + description: The ID of the organization that owns this Task. + type: string status: $ref: '#/components/schemas/TaskStatusType' required: - flux type: object - TaskCron: - description: A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) - that defines the schedule on which the task runs. InfluxDB uses the system - time when evaluating Cron expressions. - format: cron - type: string - TaskDescription: - description: A description of the task. - type: string - TaskEvery: - description: The interval ([duration literal](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)) - at which the task runs. `every` also determines when the task first runs, - depending on the specified time. - format: duration - type: string - TaskFlux: - description: | - Flux with [task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) - format: Flux - type: string - TaskName: - description: The name of the task. - type: string - TaskOffset: - description: A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) - to delay execution of the task after the scheduled time has elapsed. `0` removes - the offset. - format: duration - type: string - TaskOrg: - description: | - An organization name. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string - TaskOrgID: - description: | - An organization ID. - Identifies the [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) that owns the task. - type: string TaskStatusType: description: | `inactive` cancels scheduled runs and prevents manual runs of the task. @@ -5081,17 +5058,23 @@ components: TaskUpdateRequest: properties: cron: - $ref: '#/components/schemas/TaskCron' + description: Update the 'cron' option in the flux script. + type: string description: - $ref: '#/components/schemas/TaskDescription' + description: Update the description of the task. + type: string every: - $ref: '#/components/schemas/TaskEvery' + description: Update the 'every' option in the flux script. + type: string flux: - $ref: '#/components/schemas/TaskFlux' + description: The Flux script that the task runs. + type: string name: - $ref: '#/components/schemas/TaskName' + description: Update the 'name' option in the flux script. + type: string offset: - $ref: '#/components/schemas/TaskOffset' + description: Update the 'offset' option in the flux script. + type: string status: $ref: '#/components/schemas/TaskStatusType' type: object @@ -16316,7 +16299,7 @@ paths: /api/v2/tasks: get: description: | - Lists [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -16328,46 +16311,44 @@ paths: parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task name. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that have the specified name. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. in: query name: name schema: type: string - description: | - A task ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) created after the specified task. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. + Only returns tasks created after the specified task. in: query name: after schema: type: string - description: | - A user ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - owned by the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). + A [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. in: query name: user schema: type: string - description: | - An organization name. - Only returns tasks owned by the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. in: query name: org schema: type: string - description: | - An organization ID. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) owned by the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). + An [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. in: query name: orgID schema: type: string - description: | - A task status. - Only returns [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that have the specified status. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). in: query name: status schema: @@ -16390,9 +16371,9 @@ paths: minimum: 1 type: integer - description: | - A task type. - Specifies the level of detail for [tasks](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) in the response. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) type (`basic` or `system`). Default is `system`. + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). in: query @@ -16497,9 +16478,7 @@ paths: --header 'Authorization: Token INFLUX_API_TOKEN' post: description: | - Creates a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. - - Use this endpoint to create a scheduled task that runs a script. + Creates a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and returns the task. #### Related guides @@ -16513,17 +16492,9 @@ paths: requestBody: content: application/json: - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' schema: $ref: '#/components/schemas/TaskCreateRequest' - description: | - In the request body, provide the task. - - #### InfluxDB OSS - - - Requires either the `org` parameter or the `orgID` parameter. + description: The task to create. required: true responses: "201": @@ -16538,13 +16509,13 @@ paths: application/json: examples: missingFluxError: - summary: The request body doesn't contain a Flux query + summary: Task in request body is missing Flux query value: code: invalid message: 'failed to decode request: missing flux' orgProvidedNotFound: - summary: The organization specified by org or orgID doesn't own - the token passed in the header + summary: The org or orgID passed doesn't own the token passed in + the header value: code: invalid message: 'failed to decode request body: organization not found' @@ -16571,22 +16542,37 @@ paths: tags: - Data I/O endpoints - Tasks + x-codeSamples: + - label: 'cURL: create a task' + lang: Shell + source: | + curl http://localhost:8086/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF /api/v2/tasks/{taskID}: delete: description: | - Deletes the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a task and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status - to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). operationId: DeleteTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to delete. + - description: The ID of the task to delete. in: path name: taskID required: true @@ -16611,13 +16597,11 @@ paths: - Tasks get: description: | - Retrieves the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). operationId: GetTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve. + - description: The ID of the task to retrieve. in: path name: taskID required: true @@ -16646,22 +16630,18 @@ paths: - Tasks patch: description: | - Updates the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task), - and then cancels all scheduled runs of the task. + Updates a task and then cancels all scheduled runs of the task. - Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. + Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. - #### Related guides - - - [Update a task](https://docs.influxdata.com/influxdb/latest/process-data/manage-tasks/update-task/) - - [Task configuration options](https://docs.influxdata.com/influxdb/latest/process-data/task-options/) + To update a task, pass an object that contains the updated key-value pairs. + To activate or inactivate a task, set the `status` property. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. operationId: PatchTasksID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task)to update. + - description: The ID of the task to update. in: path name: taskID required: true @@ -16670,13 +16650,9 @@ paths: requestBody: content: application/json: - examples: - TaskWithFlux: - $ref: '#/components/examples/TaskWithFluxRequest' schema: $ref: '#/components/schemas/TaskUpdateRequest' - description: | - In the request body, provide the task properties to update. + description: An object that contains updated task properties to apply. required: true responses: "200": @@ -16701,18 +16677,13 @@ paths: /api/v2/tasks/{taskID}/labels: get: description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. operationId: GetTasksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the task to retrieve labels for. + - description: The ID of the task to retrieve labels for. in: path name: taskID required: true @@ -16741,18 +16712,13 @@ paths: - Tasks post: description: | - Adds a label to a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. operationId: PostTasksIDLabels parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to label. + - description: The ID of the task to label. in: path name: taskID required: true @@ -16763,8 +16729,7 @@ paths: application/json: schema: $ref: '#/components/schemas/LabelMapping' - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true responses: "201": @@ -16772,7 +16737,8 @@ paths: application/json: schema: $ref: '#/components/schemas/LabelResponse' - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for + the task. "400": $ref: '#/components/responses/BadRequestError' "401": @@ -16789,21 +16755,17 @@ paths: /api/v2/tasks/{taskID}/labels/{labelID}: delete: description: | - Deletes a label from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Deletes a label from a task. operationId: DeleteTasksIDLabelsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to delete the label from. + - description: The ID of the task to delete the label from. in: path name: taskID required: true schema: type: string - - description: | - A label ID. - Specifies the label to delete. + - description: The ID of the label to delete. in: path name: labelID required: true @@ -16828,18 +16790,17 @@ paths: /api/v2/tasks/{taskID}/logs: get: description: | - Lists all log events for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. operationId: GetTasksIDLogs parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - to retrieve logs for. + - description: The task ID. in: path name: taskID required: true @@ -16851,7 +16812,7 @@ paths: application/json: examples: taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: events: - message: 'Started task from script: "option task = {name: \"test @@ -16868,7 +16829,7 @@ paths: runID: 09a946fc3167d000 time: "2022-07-13T08:24:37.115323Z" taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: events: - message: 'Started task from script: "option task = {name: \"task1\", @@ -16883,8 +16844,7 @@ paths: schema: $ref: '#/components/schemas/Logs' description: | - Success. - The response body contains an `events` list with logs for the task. + Success. The response body contains an `events` list with logs for the task. Each log event `message` contains detail about the event. If a task run fails, InfluxDB logs an event with the reason for the failure. "400": @@ -16897,7 +16857,7 @@ paths: $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' - summary: List logs for a task + summary: Retrieve all logs for a task tags: - Tasks /api/v2/tasks/{taskID}/members: @@ -16905,15 +16865,11 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: GetTasksIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to retrieve members for. + - description: The task ID. in: path name: taskID required: true @@ -16928,8 +16884,6 @@ paths: description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. default: content: application/json: @@ -16945,14 +16899,11 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. operationId: PostTasksIDMembers parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. - Specifies the task for the member. + - description: The task ID. in: path name: taskID required: true @@ -16963,8 +16914,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true responses: "201": @@ -16972,10 +16922,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ResourceMember' - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. default: content: application/json: @@ -16990,20 +16937,17 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: DeleteTasksIDMembersID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A user ID. Specifies the member to remove. + - description: The ID of the member to remove. in: path name: userID required: true schema: type: string - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - to remove the member from. + - description: The task ID. in: path name: taskID required: true @@ -17011,7 +16955,7 @@ paths: type: string responses: "204": - description: Success. The member is removed. + description: Member removed default: content: application/json: @@ -17028,11 +16972,11 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. operationId: GetTasksIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the task to retrieve owners for. + - description: The ID of the task to retrieve owners for. in: path name: taskID required: true @@ -17080,17 +17024,14 @@ paths: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. operationId: PostTasksIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) for the owner. + - description: The task ID. in: path name: taskID required: true @@ -17101,8 +17042,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AddResourceMemberRequestBody' - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true responses: "201": @@ -17156,20 +17096,16 @@ paths: description: | **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes an owner from a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). operationId: DeleteTasksIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A user ID. Specifies the owner to remove from the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + - description: The ID of the owner to remove. in: path name: userID required: true schema: type: string - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to remove the owner from. + - description: The task ID. in: path name: taskID required: true @@ -17177,7 +17113,7 @@ paths: type: string responses: "204": - description: Success. The owner is removed. + description: Owner removed default: content: application/json: @@ -17190,25 +17126,22 @@ paths: /api/v2/tasks/{taskID}/runs: get: description: | - Lists runs for the specified [task](https://docs.influxdata.com/influxdb/latest/process-data/). + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/latest/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. operationId: GetTasksIDRuns parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. in: path name: taskID required: true schema: type: string - - description: A task run ID. Only returns runs created after the specified - run. + - description: A task run ID. Only returns runs created after this run. in: query name: after schema: @@ -17224,7 +17157,7 @@ paths: type: integer - description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. in: query name: afterTime schema: @@ -17232,7 +17165,7 @@ paths: type: string - description: | A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/latest/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. in: query name: beforeTime schema: @@ -17264,18 +17197,10 @@ paths: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. operationId: PostTasksIDRuns parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to run. - in: path + - in: path name: taskID required: true schema: @@ -17292,18 +17217,6 @@ paths: schema: $ref: '#/components/schemas/Run' description: Success. The run is scheduled to start. - "400": - content: - application/json: - examples: - inactiveTask: - summary: Can't run an inactive task - value: - code: invalid - message: 'failed to force run: inactive task' - schema: - $ref: '#/components/schemas/Error' - description: Bad request. "401": $ref: '#/components/responses/AuthorizationError' "500": @@ -17319,7 +17232,7 @@ paths: description: | Cancels a running [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -17327,18 +17240,13 @@ paths: operationId: DeleteTasksIDRunsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) to - to cancel. + - description: The ID of the task to cancel. in: path name: taskID required: true schema: type: string - - description: | - A task run ID. - Specifies the task run to cancel. + - description: The ID of the task run to cancel. in: path name: runID required: true @@ -17383,22 +17291,19 @@ paths: - Tasks get: description: | - Retrieves the specified run for the specified [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. operationId: GetTasksIDRunsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that the task run belongs to. + - description: The ID of the task to retrieve runs for. in: path name: taskID required: true schema: type: string - - description: A task run ID. Specifies the run to retrieve. + - description: The ID of the run to retrieve. in: path name: runID required: true @@ -17453,21 +17358,20 @@ paths: /api/v2/tasks/{taskID}/runs/{runID}/logs: get: description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. operationId: GetTasksIDRunsIDLogs parameters: - $ref: '#/components/parameters/TraceSpan' - - description: A task ID. Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) - that the run belongs to. + - description: The ID of the task to get logs for. in: path name: taskID required: true schema: type: string - - description: A run ID. Specifies the task run to list logs for. + - description: The ID of the run to get logs for. in: path name: runID required: true @@ -17524,34 +17428,34 @@ paths: $ref: '#/components/responses/InternalServerError' default: $ref: '#/components/responses/GeneralServerError' - summary: List logs for a run + summary: Retrieve all logs for a run tags: - Tasks /api/v2/tasks/{taskID}/runs/{runID}/retry: post: description: | - Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). operationId: PostTasksIDRunsIDRetry parameters: - $ref: '#/components/parameters/TraceSpan' - description: | - A task ID. - Specifies the [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) that the task run belongs to. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) ID. + Specifies the task to retry. in: path name: taskID required: true schema: type: string - description: | - A task run ID. + A [task](https://docs.influxdata.com/influxdb/latest/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the diff --git a/src/cloud.yml b/src/cloud.yml index eef11d64c..080c39d7f 100644 --- a/src/cloud.yml +++ b/src/cloud.yml @@ -37,7 +37,7 @@ paths: $ref: './cloud/paths/dashboards.yml' /tasks: $ref: './cloud/paths/tasks.yml' - /tasks/{taskID}: + "/tasks/{taskID}": $ref: "./cloud/paths/tasks_taskID.yml" components: parameters: @@ -78,10 +78,6 @@ components: $ref: "./cloud/schemas/Task.yml" TaskCreateRequest: $ref: "./cloud/schemas/TaskCreateRequest.yml" - TaskScriptID: - $ref: "./cloud/schemas/TaskProperties.yml#/scriptID" - TaskScriptParameters: - $ref: "./cloud/schemas/TaskProperties.yml#/scriptParameters" TaskUpdateRequest: $ref: "./cloud/schemas/TaskUpdateRequest.yml" responses: @@ -96,7 +92,7 @@ components: TaskWithFluxRequest: $ref: "./common/requestBody/examples/TaskRequestExamples.yml#/TaskWithFluxRequest" TaskWithScriptRequest: - $ref: "./cloud/requestBody/examples/TaskRequestExamples.yml#/TaskWithScriptRequest" + $ref: "./common/requestBody/examples/TaskRequestExamples.yml#/TaskWithScriptRequest" securitySchemes: TokenAuthentication: type: apiKey diff --git a/src/cloud/paths/tasks.yml b/src/cloud/paths/tasks.yml index 7f9384da0..3d305c64f 100644 --- a/src/cloud/paths/tasks.yml +++ b/src/cloud/paths/tasks.yml @@ -3,23 +3,19 @@ get: tags: - Data I/O endpoints - Tasks - summary: List tasks + summary: List all tasks description: | - Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. - - #### Related guide - - - [Process data with InfluxDB tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/) parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: query name: name description: | - A task name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) with the specified name. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -28,29 +24,29 @@ get: schema: type: string description: | - A task ID. - Only returns [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -59,8 +55,8 @@ get: - active - inactive description: | - A task status. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -93,11 +89,8 @@ get: - in: query name: sortBy description: | - The sort field. - Specifies the task property used to sort records in the list. - Default is `name`. - - The parameter has one supported value: `name`. + The sort field. Only `name` is supported. + Specifies the field used to sort records in the list. required: false schema: type: string @@ -106,13 +99,11 @@ get: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`). Default is `system`. - + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. - To reduce the response size, set the `type` parameter to `basic` (`type=basic`) - to omit some task properties (`flux`, `createdAt`, `updatedAt`). + To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false schema: default: "" @@ -123,8 +114,8 @@ get: - in: query name: scriptID description: | - A script ID. - Only returns tasks that use the specified [invokable script](#tag/Invokable-Scripts). + A [script](#tag/Invokable-Scripts) ID. + Only returns tasks that use the specified invokable script. schema: type: string responses: @@ -160,7 +151,52 @@ post: description: | Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. - Use this endpoint to create a scheduled task that runs a script. + Use this endpoint to create a scheduled task that runs a Flux script. + + #### InfluxDB Cloud + + - You can use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: + + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` + + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: + + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` + + #### Limitations: + + - You can't use `flux` and `scriptID` for the same task. #### Related guides @@ -171,41 +207,15 @@ post: parameters: - $ref: "../../common/parameters/TraceSpan.yml" requestBody: - description: | - In the request body, provide the task. - - Set one of the following properties to provide the script that the task runs: - - `flux` - - `scriptID` - - If you set the `scriptID` property, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` - - If you set the `flux` property, you must provide the `task` configuration option - in the Flux script. - - See [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - for detail and examples. - - #### Limitations: - - - You can't use `flux` and `scriptID` in the same task. + description: The task to create required: true content: application/json: schema: $ref: "../schemas/TaskCreateRequest.yml" - examples: - TaskWithFlux: - $ref: "../../common/requestBody/examples/TaskRequestExamples.yml#/TaskWithFluxRequest" - TaskWithScriptID: - $ref: "../requestBody/examples/TaskRequestExamples.yml#/TaskWithScriptRequest" responses: "201": - description: Success. The response body contains a `tasks` list with the task. + description: Success. The response body contains a `tasks` list with the new task. content: application/json: schema: @@ -217,10 +227,8 @@ post: #### InfluxDB Cloud - - Returns this error if the task doesn't contain the `flux` property - or the `scriptID` property. - - Returns this error if the task contains `flux` _and_ `scriptID` - properties. + - Returns this error if the task doesn't contain one of _`flux`_ or _`scriptID`_. + - Returns this error if the task contains _`flux`_ _and_ _`scriptID`_. content: application/json: schema: @@ -250,3 +258,41 @@ post: application/json: schema: $ref: "../../common/schemas/Error.yml" + x-codeSamples: + - lang: Shell + label: "cURL: create a Flux script task" + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF + - lang: Shell + label: "cURL: create a Flux script reference task" + source: | + curl INFLUX_URL/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "scriptID": "085138a111448000", + "scriptParameters": + { + "rangeStart": "-30d", + "bucket": "air_sensor", + "filterField": "temperature", + "groupColumn": "_time" + } + } + EOF diff --git a/src/cloud/paths/tasks_taskID.yml b/src/cloud/paths/tasks_taskID.yml index ca5601697..cf9786a3c 100644 --- a/src/cloud/paths/tasks_taskID.yml +++ b/src/cloud/paths/tasks_taskID.yml @@ -5,7 +5,7 @@ get: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: path @@ -14,8 +14,8 @@ get: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Specifies the task to retrieve. responses: "200": description: Success. The response body contains the task. @@ -39,52 +39,67 @@ patch: - Tasks summary: Update a task description: | - Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), + Updates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), and then cancels all scheduled runs of the task. Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. + To update a task, pass an object that contains the updated key-value pairs. To activate or inactivate a task, set the `status` property. - The `status` property set to `inactive` cancels scheduled runs and prevents manual runs of the task. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. - #### Related guides + #### InfluxDB Cloud - - [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/) - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - requestBody: - description: | - In the request body, provide the task properties to update. - To provide the script that the task runs, - set either the `flux` property or the `scriptID` property. + - Use either `flux` or `scriptID` to provide the task script. + + - `flux`: a string of "raw" Flux that contains task options and the script--for example: - If you set `scriptID`, you can set the following properties to configure the task: - - `cron` - - `every` - - `offset` - - `scriptParameters` + ```json + { + "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + "status": "active", + "description": "This task downsamples CPU data every hour" + } + ``` - If you set the `flux` property, provide the `task` configuration option - in the Flux script. + - `scriptID`: the ID of an [invokable script](#tag/Invokable-Scripts) + for the task to run. + To pass task options when using `scriptID`, pass the options as + properties in the request body--for example: - See [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - for detail and examples. + ```json + { + "name": "CPU Total 1 Hour New", + "description": "This task downsamples CPU data every hour", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + } + } + ``` - #### Limitations: + #### Limitations: - - You can't set `flux` and `scriptID` properties for the same task--for - example, if you set the `scriptID` property, then InfluxDB sets the `flux` property - to an empty string (`""`). + - You can't use `flux` and `scriptID` for the same task. + requestBody: + description: An task update to apply. required: true content: application/json: schema: $ref: "../schemas/TaskUpdateRequest.yml" - examples: - TaskWithFlux: - $ref: "../../common/requestBody/examples/TaskRequestExamples.yml#/TaskWithFluxRequest" - TaskWithScriptID: - $ref: "../requestBody/examples/TaskRequestExamples.yml#/TaskWithScriptRequest" parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: path @@ -93,8 +108,8 @@ patch: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to update. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Specifies the task to update. responses: "200": description: Success. The response body contains the updated task. @@ -118,13 +133,12 @@ delete: - Tasks summary: Delete a task description: | - Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task's `status` - property to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: path @@ -132,9 +146,7 @@ delete: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete. + description: A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. Specifies the task to delete. responses: "204": description: Success. The task and task runs are deleted. Scheduled runs are canceled. diff --git a/src/cloud/requestBody/examples/TaskRequestExamples.yml b/src/cloud/requestBody/examples/TaskRequestExamples.yml deleted file mode 100644 index 5b4346d28..000000000 --- a/src/cloud/requestBody/examples/TaskRequestExamples.yml +++ /dev/null @@ -1,17 +0,0 @@ -TaskWithScriptRequest: - summary: A task with an invokable script - description: | - Sets properties for a task that runs an _invokable script_. - value: { - "name": "CPU Total 1 Hour New", - "every": "1h", - "scriptID": "SCRIPT_ID", - "scriptParameters": - { - "rangeStart": "-1h", - "bucket": "telegraf", - "filterField": "cpu-total" - }, - "status": "active", - "description": "This task runs an invokable script every hour with the defined parameters." - } diff --git a/src/cloud/schemas/Task.yml b/src/cloud/schemas/Task.yml index d8624ed17..408544852 100644 --- a/src/cloud/schemas/Task.yml +++ b/src/cloud/schemas/Task.yml @@ -1,45 +1,142 @@ type: object properties: id: - $ref: ../../common/schemas/TaskProperties.yml#/id + readOnly: true + type: string orgID: - $ref: ../../common/schemas/TaskProperties.yml#/orgID + description: | + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string org: - $ref: ../../common/schemas/TaskProperties.yml#/org + description: | + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string name: - $ref: ../../common/schemas/TaskProperties.yml#/name - description: - $ref: ../../common/schemas/TaskProperties.yml#/description + description: The name of the task. + type: string ownerID: - $ref: ../../common/schemas/TaskProperties.yml#/ownerID + description: | + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Specifies the owner of the task. + + To find a user ID, you can use the + [`GET /api/v2/users` endpoint](#operation/GetUsers) to + list users. + type: string + description: + description: A description of the task. + type: string status: - $ref: ../../common/schemas/TaskProperties.yml#/status + $ref: "../../common/schemas/TaskStatusType.yml" labels: - $ref: ../../common/schemas/TaskProperties.yml#/labels + $ref: "../../common/schemas/Labels.yml" authorizationID: - $ref: ../../common/schemas/TaskProperties.yml#/authorizationID + description: | + An authorization ID. + Specifies the authorization used when the task communicates with the query engine. + + To find an authorization ID, use the + [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to + list authorizations. + type: string flux: - $ref: ../../common/schemas/TaskProperties.yml#/flux + description: | + The Flux script that the task executes. + + #### Limitations + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string + format: flux every: - $ref: ../../common/schemas/TaskProperties.yml#/every + description: >- + The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string + format: duration cron: - $ref: ../../common/schemas/TaskProperties.yml#/cron + description: >- + A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. + InfluxDB uses the system time when evaluating Cron expressions. + type: string offset: - $ref: ../../common/schemas/TaskProperties.yml#/offset + description: >- + A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. + `0` removes the offset. + type: string + format: duration latestCompleted: - $ref: ../../common/schemas/TaskProperties.yml#/latestCompleted + description: >- + A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. + type: string + format: date-time + readOnly: true lastRunStatus: - $ref: ../../common/schemas/TaskProperties.yml#/lastRunStatus + readOnly: true + type: string + enum: + - failed + - success + - canceled lastRunError: - $ref: ../../common/schemas/TaskProperties.yml#/lastRunError + readOnly: true + type: string createdAt: - $ref: ../../common/schemas/TaskProperties.yml#/createdAt + type: string + format: date-time + readOnly: true updatedAt: - $ref: ../../common/schemas/TaskProperties.yml#/updatedAt + type: string + format: date-time + readOnly: true links: - $ref: ../../common/schemas/TaskProperties.yml#/links + type: object + readOnly: true + example: + self: "/api/v2/tasks/1" + owners: "/api/v2/tasks/1/owners" + members: "/api/v2/tasks/1/members" + labels: "/api/v2/tasks/1/labels" + runs: "/api/v2/tasks/1/runs" + logs: "/api/v2/tasks/1/logs" + properties: + self: + $ref: "../../common/schemas/Link.yml" + owners: + $ref: "../../common/schemas/Link.yml" + members: + $ref: "../../common/schemas/Link.yml" + runs: + $ref: "../../common/schemas/Link.yml" + logs: + $ref: "../../common/schemas/Link.yml" + labels: + $ref: "../../common/schemas/Link.yml" scriptID: - $ref: ./TaskProperties.yml#/scriptID + description: | + A script ID. + Specifies the [invokable script](#tag/Invokable-Scripts) that the task executes. + + #### Limitations + + - If you use the `scriptID` property, you can't use the `flux` property. + + #### Related guides + + - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) + type: string scriptParameters: - $ref: ./TaskProperties.yml#/scriptParameters + description: | + Key-value pairs for `params` in the script. + Defines the invocation parameter values passed to the script specified by `scriptID`. + When running the task, InfluxDB executes the script with the parameters + you provide. + + #### Limitations + + - To use `scriptParameters`, you must provide a `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object + required: [id, name, orgID] diff --git a/src/cloud/schemas/TaskCreateRequest.yml b/src/cloud/schemas/TaskCreateRequest.yml index ea1b8c2ba..4fcaead8e 100644 --- a/src/cloud/schemas/TaskCreateRequest.yml +++ b/src/cloud/schemas/TaskCreateRequest.yml @@ -1,24 +1,57 @@ -type: object -properties: - orgID: - $ref: ../../common/schemas/TaskProperties.yml#/orgID - org: - $ref: ../../common/schemas/TaskProperties.yml#/org - name: - $ref: ../../common/schemas/TaskProperties.yml#/name - description: - $ref: ../../common/schemas/TaskProperties.yml#/description - every: - $ref: ../../common/schemas/TaskProperties.yml#/every - cron: - $ref: ../../common/schemas/TaskProperties.yml#/cron - offset: - $ref: ../../common/schemas/TaskProperties.yml#/offset - status: - $ref: ../../common/schemas/TaskProperties.yml#/status - flux: - $ref: ../../common/schemas/TaskProperties.yml#/flux - scriptID: - $ref: ./TaskProperties.yml#/scriptID - scriptParameters: - $ref: ./TaskProperties.yml#/scriptParameters + type: object + properties: + orgID: + description: The ID of the organization that owns the task. + type: string + org: + description: The name of the organization that owns the task. + type: string + status: + $ref: "../../common/schemas/TaskStatusType.yml" + flux: + description: | + The Flux script that the task runs. + + #### Limitations + + - If you use the `flux` property, you can't use the `scriptID` and `scriptParameters` properties. + type: string + description: + description: The description of the task. + type: string + scriptID: + description: | + The ID of the script that the task runs. + + #### Limitations + + - If you use the `scriptID` property, you can't use the `flux` property. + type: string + scriptParameters: + description: | + The parameter key-value pairs passed to the script (referenced by `scriptID`) during the task run. + + #### Limitations + + - `scriptParameters` requires `scriptID`. + - If you use the `scriptID` and `scriptParameters` properties, you can't use the `flux` property. + type: object + name: + description: The name of the task + type: string + every: + description: | + The interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string + cron: + description: >- + A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. + InfluxDB bases cron runs on the system time. + type: string + offset: + description: >- + A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. + `0` removes the offset. + type: string + format: duration diff --git a/src/cloud/schemas/TaskProperties.yml b/src/cloud/schemas/TaskProperties.yml deleted file mode 100644 index 488cc2da3..000000000 --- a/src/cloud/schemas/TaskProperties.yml +++ /dev/null @@ -1,26 +0,0 @@ -scriptID: - description: | - A script ID. - Identifies the [invokable script](#tag/Invokable-Scripts) that the task runs. - - #### Related guides - - - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: string -scriptParameters: - description: | - Key-value pairs for `params` in the script. - Defines the invocation parameter values passed to the [invokable script](#tag/Invokable-Scripts) specified - by the `scriptID` property. - When running the task, InfluxDB executes the script with the parameters - you provide. - - #### Limitations - - - To use the `scriptParameters` property, you must also set the `scriptID` property - for the task. - - #### Related guides - - - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script). - type: object diff --git a/src/cloud/schemas/TaskUpdateRequest.yml b/src/cloud/schemas/TaskUpdateRequest.yml index adcd26cf7..3b1b82ee9 100644 --- a/src/cloud/schemas/TaskUpdateRequest.yml +++ b/src/cloud/schemas/TaskUpdateRequest.yml @@ -1,20 +1,28 @@ type: object properties: status: - $ref: ../../common/schemas/TaskProperties.yml#/status + $ref: "../../common/schemas/TaskStatusType.yml" + flux: + description: Update the Flux script that the task runs. + type: string name: - $ref: ../../common/schemas/TaskProperties.yml#/name - description: - $ref: ../../common/schemas/TaskProperties.yml#/description + description: Update the 'name' option in the flux script. + type: string every: - $ref: ../../common/schemas/TaskProperties.yml#/every + description: Update the 'every' option in the flux script. + type: string cron: - $ref: ../../common/schemas/TaskProperties.yml#/cron + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: ../../common/schemas/TaskProperties.yml#/offset - flux: - $ref: ../../common/schemas/TaskProperties.yml#/flux + description: Update the 'offset' option in the flux script. + type: string + description: + description: Update the description of the task. + type: string scriptID: - $ref: ./TaskProperties.yml#/scriptID + description: Update the 'scriptID' of the task. + type: string scriptParameters: - $ref: ./TaskProperties.yml#/scriptParameters + description: Update the 'scriptParameters' of the task. + type: object diff --git a/src/common/_schemas.yml b/src/common/_schemas.yml index bbabecfe2..a532d32f7 100644 --- a/src/common/_schemas.yml +++ b/src/common/_schemas.yml @@ -160,22 +160,6 @@ $ref: "./common/schemas/Run.yml" RunManually: $ref: "./common/schemas/RunManually.yml" - TaskCron: - $ref: "./common/schemas/TaskProperties.yml#/cron" - TaskDescription: - $ref: "./common/schemas/TaskProperties.yml#/description" - TaskEvery: - $ref: "./common/schemas/TaskProperties.yml#/every" - TaskFlux: - $ref: "./common/schemas/TaskProperties.yml#/flux" - TaskName: - $ref: "./common/schemas/TaskProperties.yml#/name" - TaskOffset: - $ref: "./common/schemas/TaskProperties.yml#/offset" - TaskOrg: - $ref: "./common/schemas/TaskProperties.yml#/org" - TaskOrgID: - $ref: "./common/schemas/TaskProperties.yml#/orgID" TaskStatusType: $ref: "./common/schemas/TaskStatusType.yml" UserResponse: diff --git a/src/common/paths/tasks.yml b/src/common/paths/tasks.yml index e8c6e825f..ae048e773 100644 --- a/src/common/paths/tasks.yml +++ b/src/common/paths/tasks.yml @@ -5,7 +5,7 @@ get: - Tasks summary: List tasks description: | - Lists [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a list of [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). To limit which tasks are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. @@ -18,9 +18,8 @@ get: - in: query name: name description: | - A task name. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - that have the specified name. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) name. + Only returns tasks with the specified name. Different tasks may have the same name. schema: type: string @@ -29,30 +28,29 @@ get: schema: type: string description: | - A task ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) created after the specified task. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Only returns tasks created after the specified task. - in: query name: user schema: type: string description: | - A user ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - owned by the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Only returns tasks owned by the specified user. - in: query name: org schema: type: string description: | - An organization name. - Only returns tasks owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Only returns tasks owned by the specified organization. - in: query name: orgID schema: type: string description: | - An organization ID. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) owned by the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Only returns tasks owned by the specified organization. - in: query name: status schema: @@ -61,8 +59,8 @@ get: - active - inactive description: | - A task status. - Only returns [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that have the specified status. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) status. + Only returns tasks that have the specified status (`active` or `inactive`). - in: query name: limit schema: @@ -80,9 +78,9 @@ get: - in: query name: type description: | - A task type. - Specifies the level of detail for [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) in the response. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) type (`basic` or `system`). Default is `system`. + Specifies the level of detail for tasks in the response. The default (`system`) response contains all the metadata properties for tasks. To reduce the response size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`). required: false @@ -123,9 +121,7 @@ post: - Tasks summary: Create a task description: | - Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. - - Use this endpoint to create a scheduled task that runs a script. + Creates a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and returns the task. #### Related guides @@ -136,20 +132,12 @@ post: parameters: - $ref: "../parameters/TraceSpan.yml" requestBody: - description: | - In the request body, provide the task. - - #### InfluxDB OSS - - - Requires either the `org` parameter or the `orgID` parameter. + description: The task to create. required: true content: application/json: schema: $ref: "../schemas/TaskCreateRequest.yml" - examples: - TaskWithFlux: - $ref: "../requestBody/examples/TaskRequestExamples.yml#/TaskWithFluxRequest" responses: "201": description: Success. The response body contains a `tasks` list with the task. @@ -171,18 +159,18 @@ post: $ref: "../schemas/Error.yml" examples: orgProvidedNotFound: - summary: The organization specified by org or orgID doesn't own the token passed in the header + summary: The org or orgID passed doesn't own the token passed in the header value: { - "code":"invalid", - "message":"failed to decode request body: organization not found" + "code": "invalid", + "message": "failed to decode request body: organization not found", } missingFluxError: - summary: The request body doesn't contain a Flux query + summary: Task in request body is missing Flux query value: { - "code":"invalid", - "message": "failed to decode request: missing flux" + "code": "invalid", + "message": "failed to decode request: missing flux", } "401": $ref: "../responses/AuthorizationError.yml" @@ -194,3 +182,21 @@ post: application/json: schema: $ref: "../schemas/Error.yml" + x-codeSamples: + - lang: Shell + label: "cURL: create a task" + source: | + curl http://localhost:8086/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF diff --git a/src/common/paths/tasks_taskID.yml b/src/common/paths/tasks_taskID.yml index 9452fbd38..d69400030 100644 --- a/src/common/paths/tasks_taskID.yml +++ b/src/common/paths/tasks_taskID.yml @@ -5,7 +5,7 @@ get: - Tasks summary: Retrieve a task description: | - Retrieves the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -13,9 +13,7 @@ get: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve. + description: The ID of the task to retrieve. responses: "200": description: Success. The response body contains the task. @@ -39,27 +37,21 @@ patch: - Tasks summary: Update a task description: | - Updates the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task), - and then cancels all scheduled runs of the task. + Updates a task and then cancels all scheduled runs of the task. - Use this endpoint to set, modify, or clear task properties--for example: `cron`, `name`, `flux`, `status`. + Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. - #### Related guides - - - [Update a task]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/update-task/) - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) + To update a task, pass an object that contains the updated key-value pairs. + To activate or inactivate a task, set the `status` property. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. requestBody: - description: | - In the request body, provide the task properties to update. + description: An object that contains updated task properties to apply. required: true content: application/json: schema: $ref: "../schemas/TaskUpdateRequest.yml" - examples: - TaskWithFlux: - $ref: "../requestBody/examples/TaskRequestExamples.yml#/TaskWithFluxRequest" parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -67,9 +59,7 @@ patch: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)to update. + description: The ID of the task to update. responses: "200": description: Success. The response body contains the updated task. @@ -93,13 +83,12 @@ delete: - Tasks summary: Delete a task description: | - Deletes the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - and all associated records (task runs, logs, and labels). + Deletes a task and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). Once the task is deleted, InfluxDB cancels all scheduled runs of the task. - To disable a task instead of delete it, use - [`PATCH /api/v2/tasks/TASK_ID`](#operation/PatchTasksID) to set the task status - to `inactive`. + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -107,9 +96,7 @@ delete: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete. + description: The ID of the task to delete. responses: "204": description: Success. The task and runs are deleted. Scheduled runs are canceled. diff --git a/src/common/paths/tasks_taskID_labels.yml b/src/common/paths/tasks_taskID_labels.yml index b1f252d34..9e45af5ea 100644 --- a/src/common/paths/tasks_taskID_labels.yml +++ b/src/common/paths/tasks_taskID_labels.yml @@ -4,12 +4,9 @@ get: - Tasks summary: List labels for a task description: | - Lists all labels for a task. + Retrieves a list of all labels for a task. - Use this endpoint to list labels applied to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Labels may be used for grouping and filtering tasks. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -17,9 +14,7 @@ get: schema: type: string required: true - description: | - A task ID. - Specifies the task to retrieve labels for. + description: The ID of the task to retrieve labels for. responses: "200": description: Success. The response body contains a list of all labels for the task. @@ -43,12 +38,9 @@ post: - Tasks summary: Add a label to a task description: | - Adds a label to a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Adds a label to a task. - Use this endpoint to add a label to a task. - Labels are a way to add metadata to InfluxDB resources. - You can use labels for grouping and filtering resources in the - InfluxDB UI, `influx` CLI, and InfluxDB API. + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -56,12 +48,9 @@ post: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to label. + description: The ID of the task to label. requestBody: - description: | - In the request body, provide an object that specifies the label. + description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: @@ -69,7 +58,7 @@ post: $ref: "../schemas/LabelMapping.yml" responses: "201": - description: Success. The response body contains the label. + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: diff --git a/src/common/paths/tasks_taskID_labels_labelID.yml b/src/common/paths/tasks_taskID_labels_labelID.yml index f94089011..4057d15e3 100644 --- a/src/common/paths/tasks_taskID_labels_labelID.yml +++ b/src/common/paths/tasks_taskID_labels_labelID.yml @@ -4,7 +4,7 @@ delete: - Tasks summary: Delete a label from a task description: | - Deletes a label from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Deletes a label from a task. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -12,17 +12,13 @@ delete: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to delete the label from. + description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true - description: | - A label ID. - Specifies the label to delete. + description: The ID of the label to delete. responses: "204": description: Success. The label is deleted. diff --git a/src/common/paths/tasks_taskID_logs.yml b/src/common/paths/tasks_taskID_logs.yml index 433137665..5e7f760b2 100644 --- a/src/common/paths/tasks_taskID_logs.yml +++ b/src/common/paths/tasks_taskID_logs.yml @@ -2,12 +2,12 @@ get: operationId: GetTasksIDLogs tags: - Tasks - summary: List logs for a task + summary: Retrieve all logs for a task description: | - Lists all log events for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a list of all logs for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). - When a task runs, InfluxDB creates a `run` record in the task’s history. - Logs associated with each run provide relevant log messages, timestamps, and the exit status of the `run` attempt. + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. Use this endpoint to retrieve only the log events for a task, without additional task metadata. @@ -18,21 +18,20 @@ get: schema: type: string required: true - description: A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve logs for. + description: The task ID. responses: "200": description: | - Success. - The response body contains an `events` list with logs for the task. - Each log event `message` contains detail about the event. - If a task run fails, InfluxDB logs an event with the reason for the failure. + Success. The response body contains an `events` list with logs for the task. + Each log event `message` contains detail about the event. + If a task run fails, InfluxDB logs an event with the reason for the failure. content: application/json: schema: $ref: "../schemas/Logs.yml" examples: taskSuccess: - summary: Events for a successful task run + summary: Events for a successful task run. value: "events": [ { @@ -47,7 +46,7 @@ get: } ] taskFailure: - summary: Events for a failed task run + summary: Events for a failed task run. value: { "events": [ { diff --git a/src/common/paths/tasks_taskID_members.yml b/src/common/paths/tasks_taskID_members.yml index 479c4ef4f..7d4cb763c 100644 --- a/src/common/paths/tasks_taskID_members.yml +++ b/src/common/paths/tasks_taskID_members.yml @@ -6,9 +6,7 @@ get: summary: List all task members description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Lists all users that have the `member` role for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -16,16 +14,12 @@ get: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to retrieve members for. + description: The task ID. responses: "200": description: | Success. The response body contains a list of `users` that have the `member` role for a task. - - If the task has no members, the response contains an empty `users` array. content: application/json: schema: @@ -46,8 +40,7 @@ post: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to members of the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) and then returns - the member. + Adds a user to members of a task and returns the member. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -55,12 +48,9 @@ post: schema: type: string required: true - description: | - A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. - Specifies the task for the member. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as a member of the task. required: true content: application/json: @@ -68,10 +58,7 @@ post: $ref: "../schemas/AddResourceMemberRequestBody.yml" responses: "201": - description: | - Created. The task `member` role is assigned to the user. - The response body contains the resource member with - role and user detail. + description: Created. The user is added to task members. content: application/json: schema: diff --git a/src/common/paths/tasks_taskID_members_userID.yml b/src/common/paths/tasks_taskID_members_userID.yml index abc08c313..dfb3ae26e 100644 --- a/src/common/paths/tasks_taskID_members_userID.yml +++ b/src/common/paths/tasks_taskID_members_userID.yml @@ -6,9 +6,7 @@ delete: summary: Remove a member from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - - Removes a member from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -16,16 +14,16 @@ delete: schema: type: string required: true - description: A user ID. Specifies the member to remove. + description: The ID of the member to remove. - in: path name: taskID schema: type: string required: true - description: A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the member from. + description: The task ID. responses: "204": - description: Success. The member is removed. + description: Member removed default: description: Unexpected error content: diff --git a/src/common/paths/tasks_taskID_owners.yml b/src/common/paths/tasks_taskID_owners.yml index 874137695..ed2615930 100644 --- a/src/common/paths/tasks_taskID_owners.yml +++ b/src/common/paths/tasks_taskID_owners.yml @@ -8,7 +8,7 @@ get: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Lists all users that have the `owner` role for the specified task. + Retrieves all users that have owner permission for a task. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -16,7 +16,7 @@ get: schema: type: string required: true - description: A task ID. Specifies the task to retrieve owners for. + description: The ID of the task to retrieve owners for. responses: "200": description: | @@ -60,8 +60,7 @@ post: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Adds a specified user to owners of the specified task and then returns the - owner. + Assigns a task `owner` role to a user. Use this endpoint to create a _resource owner_ for the task. A _resource owner_ is a user with `role: owner` for a specific resource. @@ -72,12 +71,9 @@ post: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) for the owner. + description: The task ID. requestBody: - description: | - In the request body, provide an object that specifies the user. + description: A user to add as an owner of the task. required: true content: application/json: diff --git a/src/common/paths/tasks_taskID_owners_userID.yml b/src/common/paths/tasks_taskID_owners_userID.yml index 7f65d1280..e319e00be 100644 --- a/src/common/paths/tasks_taskID_owners_userID.yml +++ b/src/common/paths/tasks_taskID_owners_userID.yml @@ -8,7 +8,6 @@ delete: **Deprecated**: Tasks don't use `owner` and `member` roles. Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. - Removes an owner from a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -16,18 +15,16 @@ delete: schema: type: string required: true - description: A user ID. Specifies the owner to remove from the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + description: The ID of the owner to remove. - in: path name: taskID schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to remove the owner from. + description: The task ID. responses: "204": - description: Success. The owner is removed. + description: Owner removed default: description: Unexpected error content: diff --git a/src/common/paths/tasks_taskID_runs.yml b/src/common/paths/tasks_taskID_runs.yml index 8e9146e9a..31c4728dc 100644 --- a/src/common/paths/tasks_taskID_runs.yml +++ b/src/common/paths/tasks_taskID_runs.yml @@ -4,11 +4,10 @@ get: - Tasks summary: List runs for a task description: | - Lists runs for the specified [task]({{% INFLUXDB_DOCS_URL %}}/process-data/). + Retrieves a list of runs for a [task]({{% INFLUXDB_DOCS_URL %}}/process-data/). To limit which task runs are returned, pass query parameters in your request. - If you don't pass query parameters, InfluxDB returns all runs for the task - up to the default `limit`. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -17,16 +16,15 @@ get: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to - to list runs for. + The ID of the task to get runs for. + Only returns runs for this task. - in: query name: after schema: type: string description: A task run ID. - Only returns runs created after the specified run. + Only returns runs created after this run. - in: query name: limit schema: @@ -43,7 +41,7 @@ get: format: date-time description: | A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled after the specified time. + Only returns runs scheduled after this time. - in: query name: beforeTime schema: @@ -51,7 +49,7 @@ get: format: date-time description: | A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)). - Only returns runs scheduled before the specified time. + Only returns runs scheduled before this time. responses: "200": description: Success. The response body contains the list of task runs. @@ -80,10 +78,6 @@ post: To _retry_ a previous run (and avoid creating a new run), use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry` endpoint](#operation/PostTasksIDRunsIDRetry). - - #### Limitations - - - Queuing a task run requires that the task's `status` property be set to `active`. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -91,10 +85,6 @@ post: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to - to run. requestBody: content: application/json: @@ -107,19 +97,6 @@ post: application/json: schema: $ref: "../schemas/Run.yml" - "400": - description: Bad request. - content: - application/json: - schema: - $ref: "../schemas/Error.yml" - examples: - inactiveTask: - summary: Can't run an inactive task - value: { - "code": "invalid", - "message": "failed to force run: inactive task" - } "401": $ref: "../responses/AuthorizationError.yml" "500": diff --git a/src/common/paths/tasks_taskID_runs_runID.yml b/src/common/paths/tasks_taskID_runs_runID.yml index 6dd5325c9..ecf6571f9 100644 --- a/src/common/paths/tasks_taskID_runs_runID.yml +++ b/src/common/paths/tasks_taskID_runs_runID.yml @@ -4,7 +4,7 @@ get: - Tasks summary: Retrieve a run for a task. description: | - Retrieves the specified run for the specified [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). + Retrieves a specific run for a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). Use this endpoint to retrieve detail and logs for a specific task run. parameters: @@ -14,16 +14,13 @@ get: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) - that the task run belongs to. + description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true - description: A task run ID. Specifies the run to retrieve. + description: The ID of the run to retrieve. responses: "200": description: Success. The response body contains the task run. @@ -80,7 +77,7 @@ delete: description: | Cancels a running [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task). - Use this endpoint to cancel a running task. + Use this endpoint with InfluxDB OSS to cancel a running task. #### InfluxDB Cloud @@ -92,18 +89,13 @@ delete: schema: type: string required: true - description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) to - to cancel. + description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true - description: | - A task run ID. - Specifies the task run to cancel. + description: The ID of the task run to cancel. responses: "204": description: | diff --git a/src/common/paths/tasks_taskID_runs_runID_logs.yml b/src/common/paths/tasks_taskID_runs_runID_logs.yml index fd8939231..8a1fc79e3 100644 --- a/src/common/paths/tasks_taskID_runs_runID_logs.yml +++ b/src/common/paths/tasks_taskID_runs_runID_logs.yml @@ -2,12 +2,12 @@ get: operationId: GetTasksIDRunsIDLogs tags: - Tasks - summary: List logs for a run + summary: Retrieve all logs for a run description: | - Lists all logs for a task run. + Retrieves all logs for a task run. A log is a list of run events with `runID`, `time`, and `message` properties. - Use this endpoint to help analyze [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) performance and troubleshoot failed task runs. + Use this endpoint to help analyze task performance and troubleshoot failed task runs. parameters: - $ref: "../parameters/TraceSpan.yml" - in: path @@ -15,13 +15,13 @@ get: schema: type: string required: true - description: A task ID. Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the run belongs to. + description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true - description: A run ID. Specifies the task run to list logs for. + description: The ID of the run to get logs for. responses: "200": description: | diff --git a/src/common/paths/tasks_taskID_runs_runID_retry.yml b/src/common/paths/tasks_taskID_runs_runID_retry.yml index 5af3ab68d..8406bcf31 100644 --- a/src/common/paths/tasks_taskID_runs_runID_retry.yml +++ b/src/common/paths/tasks_taskID_runs_runID_retry.yml @@ -4,15 +4,15 @@ post: - Tasks summary: Retry a task run description: | - Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to - retry and then returns the scheduled run. + Queues a [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run to + retry and returns the scheduled run. To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs` endpoint](#operation/PostTasksIDRuns). #### Limitations - - Queuing a task run requires that the task's `status` property be set to `active`. + - The task must be _active_ (`status: "active"`). requestBody: content: application/json; charset=utf-8: @@ -26,15 +26,15 @@ post: type: string required: true description: | - A task ID. - Specifies the [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) that the task run belongs to. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) ID. + Specifies the task to retry. - in: path name: runID schema: type: string required: true description: | - A task run ID. + A [task]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task) run ID. Specifies the task run to retry. To find a task run ID, use the diff --git a/src/common/requestBody/examples/AuthorizationRequestExamples.yml b/src/common/requestBody/examples/AuthorizationRequestExamples.yml index 7a488f855..110b0b1d3 100644 --- a/src/common/requestBody/examples/AuthorizationRequestExamples.yml +++ b/src/common/requestBody/examples/AuthorizationRequestExamples.yml @@ -1,48 +1,48 @@ AuthorizationPostRequest: - summary: An authorization for a resource type - description: Creates an authorization. - value: { - "orgID": "INFLUX_ORG_ID", - "description": "iot_users read buckets", - "permissions": [ - { - "action": "read", - "resource": { - "type": "buckets" - } - } - ] - } -AuthorizationWithResourcePostRequest: - summary: An authorization for a resource - description: Creates an authorization for access to a specific resource. - value: { - "orgID": "INFLUX_ORG_ID", - "description": "iot_users read buckets", - "permissions": [ - { - "action": "read", - "resource": { - "type": "buckets", - "id": "INFLUX_BUCKET_ID" + summary: An authorization for a resource type + description: Creates an authorization. + value: { + "orgID": "INFLUX_ORG_ID", + "description": "iot_users read buckets", + "permissions": [ + { + "action": "read", + "resource": { + "type": "buckets" + } } - } - ] - } -AuthorizationWithUserPostRequest: - summary: An authorization scoped to a user - description: Creates an authorization scoped to a specific user. - value: { - "orgID": "INFLUX_ORG_ID", - "userID": "INFLUX_USER_ID", - "description": "iot_user write to bucket", - "permissions": [ - { - "action": "write", + ] + } +AuthorizationWithResourcePostRequest: + summary: An authorization for a resource + description: Creates an authorization for access to a specific resource. + value: { + "orgID": "INFLUX_ORG_ID", + "description": "iot_users read buckets", + "permissions": [ + { + "action": "read", "resource": { "type": "buckets", "id": "INFLUX_BUCKET_ID" } - } - ] - } + } + ] + } +AuthorizationWithUserPostRequest: + summary: An authorization scoped to a user + description: Creates an authorization scoped to a specific user. + value: { + "orgID": "INFLUX_ORG_ID", + "userID": "INFLUX_USER_ID", + "description": "iot_user write to bucket", + "permissions": [ + { + "action": "write", + "resource": { + "type": "buckets", + "id": "INFLUX_BUCKET_ID" + } + } + ] + } diff --git a/src/common/requestBody/examples/TaskRequestExamples.yml b/src/common/requestBody/examples/TaskRequestExamples.yml index f0248cead..65bb39b4c 100644 --- a/src/common/requestBody/examples/TaskRequestExamples.yml +++ b/src/common/requestBody/examples/TaskRequestExamples.yml @@ -4,13 +4,31 @@ TaskWithFluxRequest: Sets the `flux` property with Flux task options and a query. value: { "flux": "option task = {name: \"CPU Total 1 Hour New\", every: 1h}\ - from(bucket: \"telegraf\")\ - |> range(start: -1h)\ - |> filter(fn: (r) => (r._measurement == \"cpu\"))\ - |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\"))\ - |> filter(fn: (r) => (r.cpu == \"cpu-total\"))\ - |> aggregateWindow(every: 1h, fn: max)\ - |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", + from(bucket: \"telegraf\") + |> range(start: -1h) + |> filter(fn: (r) => (r._measurement == \"cpu\")) + |> filter(fn: (r) =>\n\t\t(r._field == \"usage_system\")) + |> filter(fn: (r) => (r.cpu == \"cpu-total\")) + |> aggregateWindow(every: 1h, fn: max) + |> to(bucket: \"cpu_usage_user_total_1h\", org: \"INFLUX_ORG\")", "status": "active", - "description": "This task contains Flux that configures the task schedule and downsamples CPU data every hour." + "description": "This task contains Flux that configures the task schedule + and downsamples CPU data every hour." + } +TaskWithScriptRequest: + summary: A task with an invokable script + description: | + Sets properties for a task that runs an _invokable script_. + value: { + "name": "CPU Total 1 Hour New", + "every": "1h", + "scriptID": "SCRIPT_ID", + "scriptParameters": + { + "rangeStart": "-1h", + "bucket": "telegraf", + "filterField": "cpu-total" + }, + "status": "active", + "description": "This task runs an invokable script every hour with the defined parameters." } diff --git a/src/common/schemas/Task.yml b/src/common/schemas/Task.yml index 019b28683..e338d771d 100644 --- a/src/common/schemas/Task.yml +++ b/src/common/schemas/Task.yml @@ -1,41 +1,113 @@ type: object properties: id: - $ref: ./TaskProperties.yml#/id + readOnly: true + type: string orgID: - $ref: ./TaskProperties.yml#/orgID + description: | + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) ID. + Specifies the organization that owns the task. + type: string org: - $ref: ./TaskProperties.yml#/org + description: | + An [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) name. + Specifies the organization that owns the task. + type: string name: - $ref: ./TaskProperties.yml#/name - description: - $ref: ./TaskProperties.yml#/description + description: The name of the task. + type: string ownerID: - $ref: ./TaskProperties.yml#/ownerID + description: | + A [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) ID. + Specifies the owner of the task. + + To find a user ID, you can use the + [`GET /api/v2/users` endpoint](#operation/GetUsers) to + list users. + type: string + description: + description: A description of the task. + type: string status: - $ref: ./TaskProperties.yml#/status + $ref: "./TaskStatusType.yml" labels: - $ref: ./TaskProperties.yml#/labels + $ref: "./Labels.yml" authorizationID: - $ref: ./TaskProperties.yml#/authorizationID + description: | + An authorization ID. + Specifies the authorization used when the task communicates with the query engine. + + To find an authorization ID, use the + [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to + list authorizations. + type: string flux: - $ref: ./TaskProperties.yml#/flux + description: The Flux script that the task executes. + type: string + format: flux every: - $ref: ./TaskProperties.yml#/every + description: >- + The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. + `every` also determines when the task first runs, depending on the specified time. + type: string + format: duration cron: - $ref: ./TaskProperties.yml#/cron + description: >- + A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. + InfluxDB uses the system time when evaluating Cron expressions. + type: string offset: - $ref: ./TaskProperties.yml#/offset + description: >- + A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. + `0` removes the offset. + type: string + format: duration latestCompleted: - $ref: ./TaskProperties.yml#/latestCompleted + description: >- + A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. + type: string + format: date-time + readOnly: true lastRunStatus: - $ref: ./TaskProperties.yml#/lastRunStatus + readOnly: true + type: string + enum: + - failed + - success + - canceled lastRunError: - $ref: ./TaskProperties.yml#/lastRunError + readOnly: true + type: string createdAt: - $ref: ./TaskProperties.yml#/createdAt + type: string + format: date-time + readOnly: true updatedAt: - $ref: ./TaskProperties.yml#/updatedAt + type: string + format: date-time + readOnly: true links: - $ref: ./TaskProperties.yml#/links + type: object + readOnly: true + example: + self: "/api/v2/tasks/1" + owners: "/api/v2/tasks/1/owners" + members: "/api/v2/tasks/1/members" + labels: "/api/v2/tasks/1/labels" + runs: "/api/v2/tasks/1/runs" + logs: "/api/v2/tasks/1/logs" + properties: + self: + $ref: "./Link.yml" + owners: + $ref: "./Link.yml" + members: + $ref: "./Link.yml" + runs: + $ref: "./Link.yml" + logs: + $ref: "./Link.yml" + labels: + $ref: "./Link.yml" + required: [id, name, orgID, flux] diff --git a/src/common/schemas/TaskCreateRequest.yml b/src/common/schemas/TaskCreateRequest.yml index 8034983e4..9758cca91 100644 --- a/src/common/schemas/TaskCreateRequest.yml +++ b/src/common/schemas/TaskCreateRequest.yml @@ -1,16 +1,18 @@ type: object properties: orgID: - $ref: ./TaskProperties.yml#/orgID + description: The ID of the organization that owns this Task. + type: string org: - $ref: ./TaskProperties.yml#/org - name: - $ref: ./TaskProperties.yml#/name - description: - $ref: ./TaskProperties.yml#/description - flux: - $ref: ./TaskProperties.yml#/flux + description: The name of the organization that owns this Task. + type: string status: - $ref: ./TaskProperties.yml#/status - required: - - flux + $ref: "./TaskStatusType.yml" + flux: + description: The Flux script to run for this task. + type: string + description: + description: An optional description of the task. + type: string + + required: [flux] diff --git a/src/common/schemas/TaskProperties.yml b/src/common/schemas/TaskProperties.yml deleted file mode 100644 index 4f64c13fd..000000000 --- a/src/common/schemas/TaskProperties.yml +++ /dev/null @@ -1,118 +0,0 @@ -id: - readOnly: true - type: string - description: | - The resource ID that InfluxDB uses to uniquely identify the task. -orgID: - description: | - An organization ID. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. - type: string -org: - description: | - An organization name. - Identifies the [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization) that owns the task. - type: string -name: - description: The name of the task. - type: string -description: - description: A description of the task. - type: string -ownerID: - description: | - A user ID. - Identifies the [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) that owns the task. - - To find a user ID, use the - [`GET /api/v2/users` endpoint](#operation/GetUsers) to - list users. - type: string -status: - $ref: "./TaskStatusType.yml" -labels: - $ref: "./Labels.yml" -authorizationID: - description: | - An authorization ID. - Identifies the authorization used when the task communicates with the query engine. - - To find an authorization ID, use the - [`GET /api/v2/authorizations` endpoint](#operation/GetAuthorizations) to - list authorizations. - type: string -flux: - description: | - Flux with [task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - and the script for the task to run. - - #### Related guides - - - [Task configuration options]({{% INFLUXDB_DOCS_URL %}}/process-data/task-options/) - type: string - format: Flux -every: - description: >- - The interval ([duration literal]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) at which the task runs. - `every` also determines when the task first runs, depending on the specified time. - type: string - format: duration -cron: - description: >- - A [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. - InfluxDB uses the system time when evaluating Cron expressions. - type: string - format: cron -offset: - description: >- - A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. - `0` removes the offset. - type: string - format: duration -latestCompleted: - description: >- - A timestamp ([RFC3339 date/time format]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. - type: string - format: date-time - readOnly: true -lastRunStatus: - readOnly: true - type: string - enum: - - failed - - success - - canceled -lastRunError: - readOnly: true - type: string -createdAt: - type: string - format: date-time - readOnly: true -updatedAt: - type: string - format: date-time - readOnly: true -links: - type: object - readOnly: true - example: - self: "/api/v2/tasks/1" - owners: "/api/v2/tasks/1/owners" - members: "/api/v2/tasks/1/members" - labels: "/api/v2/tasks/1/labels" - runs: "/api/v2/tasks/1/runs" - logs: "/api/v2/tasks/1/logs" - properties: - self: - $ref: "./Link.yml" - owners: - $ref: "./Link.yml" - members: - $ref: "./Link.yml" - runs: - $ref: "./Link.yml" - logs: - $ref: "./Link.yml" - labels: - $ref: "./Link.yml" diff --git a/src/common/schemas/TaskUpdateRequest.yml b/src/common/schemas/TaskUpdateRequest.yml index 3195eac1a..4f0f1289c 100644 --- a/src/common/schemas/TaskUpdateRequest.yml +++ b/src/common/schemas/TaskUpdateRequest.yml @@ -1,16 +1,22 @@ type: object properties: status: - $ref: ./TaskProperties.yml#/status + $ref: "./TaskStatusType.yml" flux: - $ref: ./TaskProperties.yml#/flux + description: The Flux script that the task runs. + type: string name: - $ref: ./TaskProperties.yml#/name + description: Update the 'name' option in the flux script. + type: string every: - $ref: ./TaskProperties.yml#/every + description: Update the 'every' option in the flux script. + type: string cron: - $ref: ./TaskProperties.yml#/cron + description: Update the 'cron' option in the flux script. + type: string offset: - $ref: ./TaskProperties.yml#/offset + description: Update the 'offset' option in the flux script. + type: string description: - $ref: ./TaskProperties.yml#/description + description: Update the description of the task. + type: string diff --git a/src/oss.yml b/src/oss.yml index a8938a4dd..59e238276 100644 --- a/src/oss.yml +++ b/src/oss.yml @@ -105,7 +105,7 @@ paths: $ref: "./common/paths/dashboards.yml" /tasks: $ref: "./common/paths/tasks.yml" - /tasks/{taskID}: + "/tasks/{taskID}": $ref: "./common/paths/tasks_taskID.yml" components: parameters: From 687f55942bf6bcc916f48fee37001cf93591302d Mon Sep 17 00:00:00 2001 From: Jeffrey Smith II Date: Wed, 25 Jan 2023 10:44:33 -0500 Subject: [PATCH 2/2] Revert "docs: complete merge of OSS and Cloud authorizations paths, describe auths (#602)" This reverts commit 9d31f38d457c9ddd4fb66a4bdb4ff40f402961ad. --- contracts/cloud-diff.yml | 419 ++++++-- contracts/cloud.json | 703 ++++++------- contracts/cloud.yml | 642 +++++------- contracts/common.yml | 417 +------- contracts/legacy.yml | 10 +- contracts/oss-diff.yml | 409 ++++++-- contracts/oss.json | 956 ++++++++---------- contracts/oss.yml | 632 +++++------- contracts/priv/cloud-priv.yml | 4 +- contracts/ref/cloud.yml | 289 ++---- contracts/ref/oss.yml | 288 ++---- src/cloud.yml | 6 +- src/cloud/paths/authorizations.yml | 145 +++ src/cloud/paths/authorizations_authID.yml | 73 ++ src/cloud/tags.yml | 30 +- src/common/_paths.yml | 4 - src/common/paths/authorizations.yml | 79 +- src/common/paths/authorizations_authID.yml | 123 +-- src/common/paths/buckets_bucketID_owners.yml | 8 +- .../paths/buckets_bucketID_owners_userID.yml | 4 +- src/common/paths/flags.yml | 4 +- src/common/paths/orgs_orgID_members.yml | 4 +- .../paths/orgs_orgID_members_userID.yml | 2 +- src/common/paths/orgs_orgID_owners.yml | 6 +- src/common/paths/orgs_orgID_owners_userID.yml | 4 +- src/common/paths/tasks_taskID_members.yml | 2 +- src/common/paths/tasks_taskID_owners.yml | 4 +- .../paths/tasks_taskID_owners_userID.yml | 2 +- .../schemas/AuthorizationUpdateRequest.yml | 2 +- src/common/schemas/RetentionRule.yml | 2 +- .../LegacyAuthorizationPostRequest.yml | 8 +- src/oss.yml | 8 +- src/oss/tags.yml | 30 +- 33 files changed, 2442 insertions(+), 2877 deletions(-) create mode 100644 src/cloud/paths/authorizations.yml create mode 100644 src/cloud/paths/authorizations_authID.yml diff --git a/contracts/cloud-diff.yml b/contracts/cloud-diff.yml index 3000c647a..209dc6602 100644 --- a/contracts/cloud-diff.yml +++ b/contracts/cloud-diff.yml @@ -426,6 +426,342 @@ paths: default: description: Unexpected error $ref: '#/paths/~1tasks/get/responses/default' + /authorizations: + get: + operationId: GetAuthorizations + tags: + - Authorizations + summary: List authorizations + description: | + Lists authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations for the organization. + + #### InfluxDB Cloud + + - InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) + values in `GET /api/v2/authorizations` responses; + returns `token: redacted` for all authorizations. + + #### Required permissions + + - `read-authorizations` + + #### Related guides + + - [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) + parameters: + - $ref: '#/paths/~1users/get/parameters/0' + - in: query + name: userID + schema: + type: string + description: | + A user ID. + Only returns authorizations scoped to the specified + [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: user + schema: + type: string + description: | + A user name. + Only returns authorizations scoped to the specified + [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: orgID + schema: + type: string + description: | + An organization ID. + Only returns authorizations that belong to the specified + [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + - in: query + name: org + schema: + type: string + description: | + An organization name. + Only returns authorizations that belong to the specified + [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + - in: query + name: token + schema: + type: string + description: | + An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value. + Returns the authorization for the specified token. + responses: + '200': + description: Success. The response body contains a list of authorizations. + content: + application/json: + schema: + type: object + properties: + links: + readOnly: true + $ref: '#/paths/~1dashboards/get/responses/200/content/application~1json/schema/properties/links' + authorizations: + type: array + items: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + '400': + description: Invalid request + $ref: '#/paths/~1tasks/get/responses/default' + '401': + $ref: '#/paths/~1tasks/get/responses/401' + '500': + $ref: '#/paths/~1users/get/responses/500' + default: + description: Unexpected error + $ref: '#/paths/~1tasks/get/responses/default' + post: + operationId: PostAuthorizations + tags: + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the authorization with the + generated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token). + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB Cloud enforces access restrictions on API tokens. + + - InfluxDB only allows access to the API token value immediately after the authorization is created. + - You can't update an authorization's permissions. + - A token stops working when the user who created the authorization is deleted. + + We recommend the following for managing your tokens: + + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. + + #### Related guides + + - [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/) + parameters: + - $ref: '#/paths/~1users/get/parameters/0' + requestBody: + description: The authorization to create. + required: true + content: + application/json: + schema: + required: + - orgID + - permissions + allOf: + - $ref: '#/paths/~1authorizations~1%7BauthID%7D/patch/requestBody/content/application~1json/schema' + - type: object + properties: + orgID: + type: string + description: | + An organization ID. + Specifies the organization that owns the authorization. + userID: + type: string + description: | + A user ID. + Specifies the user that the authorization is scoped to. + + When a user authenticates with username and password, + InfluxDB generates a _user session_ with all the permissions + specified by all the user's authorizations. + permissions: + type: array + minItems: 1 + description: | + A list of permissions for an authorization. + In the list, provide at least one `permission` object. + + In a `permission`, the `resource.type` property grants access to all + resources of the specified type. + To grant access to only a specific resource, specify the + `resource.id` property. + items: + required: + - action + - resource + properties: + action: + type: string + enum: + - read + - write + resource: + type: object + required: + - type + properties: + type: + type: string + enum: + - authorizations + - buckets + - dashboards + - orgs + - tasks + - telegrafs + - users + - variables + - secrets + - labels + - views + - documents + - notificationRules + - notificationEndpoints + - checks + - dbrp + - annotations + - sources + - scrapers + - notebooks + - remotes + - replications + - instance + - flows + - functions + - subscriptions + description: | + A resource type. + Identifies the API resource's type (or _kind_). + id: + type: string + description: | + A resource ID. + Identifies a specific resource. + name: + type: string + description: | + The name of the resource. + _Note: not all resource types have a `name` property_. + orgID: + type: string + description: | + An organization ID. + Identifies the organization that owns the resource. + org: + type: string + description: | + An organization name. + The organization that owns the resource. + examples: + AuthorizationPostRequest: + $ref: '#/components/examples/AuthorizationPostRequest' + AuthorizationWithResourcePostRequest: + $ref: '#/components/examples/AuthorizationWithResourcePostRequest' + AuthorizationWithUserPostRequest: + $ref: '#/components/examples/AuthorizationWithUserPostRequest' + responses: + '201': + description: | + Success. The authorization is created. The response body contains the authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + '400': + description: Invalid request + $ref: '#/paths/~1tasks/get/responses/default' + '401': + $ref: '#/paths/~1tasks/get/responses/401' + '500': + $ref: '#/paths/~1users/get/responses/500' + default: + description: Unexpected error + $ref: '#/paths/~1tasks/get/responses/default' + '/authorizations/{authID}': + get: + operationId: GetAuthorizationsID + tags: + - Authorizations + summary: Retrieve an authorization + parameters: + - $ref: '#/paths/~1users/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to get. + responses: + '200': + description: Authorization details + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + default: + description: Unexpected error + $ref: '#/paths/~1tasks/get/responses/default' + patch: + operationId: PatchAuthorizationsID + tags: + - Authorizations + summary: Update authorization status + description: Update an authorization's status to `active` or `inactive`. + requestBody: + description: The updated Authorization object. + required: true + content: + application/json: + schema: + properties: + status: + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' + default: active + type: string + enum: + - active + - inactive + description: + type: string + description: A description of the token. + parameters: + - $ref: '#/paths/~1users/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to update. + responses: + '200': + description: The updated authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + default: + description: Unexpected error + $ref: '#/paths/~1tasks/get/responses/default' + delete: + operationId: DeleteAuthorizationsID + tags: + - Authorizations + summary: Delete an authorization + parameters: + - $ref: '#/paths/~1users/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to delete. + responses: + '204': + description: Authorization deleted + default: + description: Unexpected error + $ref: '#/paths/~1tasks/get/responses/default' /variables: get: operationId: GetVariables @@ -3753,7 +4089,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). + [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds labels: @@ -3766,17 +4102,7 @@ components: - orgID - permissions allOf: - - properties: - status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' - default: active - type: string - enum: - - active - - inactive - description: - type: string - description: A description of the token. + - $ref: '#/paths/~1authorizations~1%7BauthID%7D/patch/requestBody/content/application~1json/schema' - type: object properties: createdAt: @@ -3799,72 +4125,7 @@ components: The list of permissions. An authorization must have at least one permission. items: - required: - - action - - resource - properties: - action: - type: string - enum: - - read - - write - resource: - type: object - required: - - type - properties: - type: - type: string - enum: - - authorizations - - buckets - - dashboards - - orgs - - tasks - - telegrafs - - users - - variables - - secrets - - labels - - views - - documents - - notificationRules - - notificationEndpoints - - checks - - dbrp - - annotations - - sources - - scrapers - - notebooks - - remotes - - replications - - instance - - flows - - functions - - subscriptions - description: | - A resource type. - Identifies the API resource's type (or _kind_). - id: - type: string - description: | - A resource ID. - Identifies a specific resource. - name: - type: string - description: | - The name of the resource. - _Note: not all resource types have a `name` property_. - orgID: - type: string - description: | - An organization ID. - Identifies the organization that owns the resource. - org: - type: string - description: | - An organization name. - The organization that owns the resource. + $ref: '#/paths/~1authorizations/post/requestBody/content/application~1json/schema/allOf/1/properties/permissions/items' id: readOnly: true type: string @@ -4661,7 +4922,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/contracts/cloud.json b/contracts/cloud.json index 53c71b2e4..c739f222a 100644 --- a/contracts/cloud.json +++ b/contracts/cloud.json @@ -16,8 +16,8 @@ ], "tags": [ { - "name": "Authorizations (API tokens)", - "description": "Create and manage authorizations (API tokens).\n\nAn _authorization_ contains a list of `read` and `write`\npermissions for organization resources and provides an API token for authentication.\nAn authorization belongs to an organization and only contains permissions for that organization.\n\nWe recommend the following for managing your tokens:\n\n- Create a generic user to create and manage tokens for writing data.\n- Store your tokens in a secure password vault for future access.\n\n### User sessions with authorizations\n\nOptionally, when creating an authorization, you can scope it to a specific user.\nIf the user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nFor more information, see [how to assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/).\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related endpoints\n\n- [Signin](#tag/Signin)\n- [Signout](#tag/Signout)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n- [Assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n" + "name": "Authorizations", + "description": "Create and manage authorizations (API tokens).\n\nAn _authorization_ contains a list of `read` and `write`\npermissions for organization resources and provides an API token for authentication.\nAn authorization belongs to an organization and only contains permissions for that organization.\n\nIn InfluxDB Cloud, an authorization with `read-authorizations` permission\ncan be used to view other authorizations.\n\n#### Limitations\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB enforces access restrictions on API tokens.\n\n- InfluxDB allows access to the API token value immediately after the authorization is created.\n- You can’t change access (read/write) permissions for an API token after it’s created.\n- Tokens stop working when the user who created the token is deleted.\n\nWe recommend the following for managing your tokens:\n\n- Create a generic user to create and manage tokens for writing data.\n- Store your tokens in a secure password vault for future access.\n\n#### User sessions with authorizations\n\nOptionally, when creating an authorization, you can scope it to a specific user.\nIf the user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nFor more information, see [how to assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/).\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related endpoints\n\n- [Signin](#tag/Signin)\n- [Signout](#tag/Signout)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n- [Assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n" }, { "name": "Buckets", @@ -29,7 +29,7 @@ }, { "name": "Invokable Scripts", - "description": "Store, manage, and execute scripts in InfluxDB.\nA script stores your custom Flux script and provides an invokable\nendpoint that accepts runtime parameters.\nIn a script, you can specify custom runtime parameters\n(`params`)--for example, `params.myparameter`.\nOnce you create a script, InfluxDB generates an\n[`/api/v2/scripts/SCRIPT_ID/invoke` endpoint](#operation/PostScriptsIDInvoke)\nfor your organization.\nYou can run the script from API requests and tasks, defining parameter\nvalues for each run.\nWhen the script runs, InfluxDB replaces `params` references in the\nscript with the runtime parameter values you define.\n\nUse the `/api/v2/scripts` endpoints to create and manage scripts.\nSee related guides to learn how to define parameters and execute scripts.\n\n### Related guides\n\n- [Invoke custom scripts]({{% INFLUXDB_DOCS_URL %}}/api-guide/api-invokable-scripts/) from API requests.\n- [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script)\n" + "description": "Store, manage, and execute scripts in InfluxDB.\nA script stores your custom Flux script and provides an invokable\nendpoint that accepts runtime parameters.\nIn a script, you can specify custom runtime parameters\n(`params`)--for example, `params.myparameter`.\nOnce you create a script, InfluxDB generates an\n[`/api/v2/scripts/SCRIPT_ID/invoke` endpoint](#operation/PostScriptsIDInvoke)\nfor your organization.\nYou can run the script from API requests and tasks, defining parameter\nvalues for each run.\nWhen the script runs, InfluxDB replaces `params` references in the\nscript with the runtime parameter values you define.\n\nUse the `/api/v2/scripts` endpoints to create and manage scripts.\nSee related guides to learn how to define parameters and execute scripts.\n\n#### Related guides\n\n- [Invoke custom scripts]({{% INFLUXDB_DOCS_URL %}}/api-guide/api-invokable-scripts/) from API requests.\n- [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script)\n" }, { "name": "Delete", @@ -45,15 +45,15 @@ }, { "name": "Tasks", - "description": "Process and analyze your data with [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nin the InfluxDB task engine.\nUse the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs.\n\nTo configure a task, provide the script and the schedule to run the task.\nFor examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks).\n\n\n\n### Properties\n\nA `task` object contains information about an InfluxDB task resource.\n\nThe following table defines the properties that appear in this object:\n\n\n\n### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Create a script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/#create-an-invokable-script)\n" + "description": "Process and analyze your data with [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nin the InfluxDB task engine.\nUse the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs.\n\nTo configure a task, provide the script and the schedule to run the task.\nFor examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks).\n\n\n\n#### Properties\n\nA `task` object contains information about an InfluxDB task resource.\n\nThe following table defines the properties that appear in this object:\n\n\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n- [Create a script](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/#create-an-invokable-script)\n" }, { "name": "Templates", - "description": "Export and apply InfluxDB **templates**.\nManage **stacks** of templated InfluxDB resources.\n\nInfluxDB templates are prepackaged configurations for resources.\nUse InfluxDB templates to configure a fresh instance of InfluxDB,\nback up your dashboard configuration, or share your configuration.\n\nUse the `/api/v2/templates` endpoints to export templates and apply templates.\n\n**InfluxDB stacks** are stateful InfluxDB templates that let you\nadd, update, and remove installed template resources over time, avoid duplicating\nresources when applying the same or similar templates more than once, and\napply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud.\n\nUse the `/api/v2/stacks` endpoints to manage installed template resources.\n\n### Related guides\n\n- [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/)\n- [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/)\n" + "description": "Export and apply InfluxDB **templates**.\nManage **stacks** of templated InfluxDB resources.\n\nInfluxDB templates are prepackaged configurations for resources.\nUse InfluxDB templates to configure a fresh instance of InfluxDB,\nback up your dashboard configuration, or share your configuration.\n\nUse the `/api/v2/templates` endpoints to export templates and apply templates.\n\n**InfluxDB stacks** are stateful InfluxDB templates that let you\nadd, update, and remove installed template resources over time, avoid duplicating\nresources when applying the same or similar templates more than once, and\napply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud.\n\nUse the `/api/v2/stacks` endpoints to manage installed template resources.\n\n#### Related guides\n\n- [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/)\n- [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/)\n" }, { "name": "Users", - "description": "Retrieve specific users.\n\nInfluxDB Cloud lets you invite and collaborate with multiple users in your organization.\nTo invite and remove users from your organization, use the InfluxDB Cloud user interface (UI);\nyou can't use the InfluxDB API to manage users in InfluxDB Cloud.\nOnce a user is added to your organization, you can use the\n`GET /api/v2/users` and `GET /api/v2/users/USER_ID` API endpoints to\nview specific members.\n\n### User sessions with authorizations\n\nOptionally, you can scope an authorization (and its API token) to a user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n" + "description": "Retrieve specific users.\n\nInfluxDB Cloud lets you invite and collaborate with multiple users in your organization.\nTo invite and remove users from your organization, use the InfluxDB Cloud user interface (UI);\nyou can't use the InfluxDB API to manage users in InfluxDB Cloud.\nOnce a user is added to your organization, you can use the\n`GET /api/v2/users` and `GET /api/v2/users/USER_ID` API endpoints to\nview specific members.\n\n#### User sessions with authorizations\n\nOptionally, you can scope an authorization (and its API token) to a user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n" }, { "name": "Write", @@ -87,7 +87,7 @@ { "name": "Pagination", "x-traitTag": true, - "description": "Some InfluxDB API [list operations](#tag/SupportedOperations) may support the following query parameters for paginating results:\n\n | Query parameter | Value type | Description |\n |:------------------------ |:--------------------- |:-------------------------------------------|\n | `limit` | integer | The maximum number of records to return (after other parameters are applied). |\n | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). |\n | `after` | string (resource ID) | Only returns resources created after the specified resource. |\n\n ### Limitations\n\n - For specific endpoint parameters and examples, see the endpoint definition.\n - If you specify an `offset` parameter value greater than the total number of records,\n then InfluxDB returns an empty list in the response\n (given `offset` skips the specified number of records).\n\n The following example passes `offset=50` to skip the first 50 results,\n but the user only has 10 buckets:\n\n ```sh\n curl --request GET \"INFLUX_URL/api/v2/buckets?limit=1&offset=50\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n ```\n\n The response contains the following:\n\n ```json\n {\n \"links\": {\n \"prev\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=49\\u0026orgID=ORG_ID\",\n \"self\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=50\\u0026orgID=ORG_ID\"\n },\n \"buckets\": []\n }\n ```\n" + "description": "Some InfluxDB API [list operations](#tag/SupportedOperations) may support the following query parameters for paginating results:\n\n | Query parameter | Value type | Description |\n |:------------------------ |:--------------------- |:-------------------------------------------|\n | `limit` | integer | The maximum number of records to return (after other parameters are applied). |\n | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). |\n | `after` | string (resource ID) | Only returns resources created after the specified resource. |\n\n #### Limitations\n\n - For specific endpoint parameters and examples, see the endpoint definition.\n - If you specify an `offset` parameter value greater than the total number of records,\n then InfluxDB returns an empty list in the response\n (given `offset` skips the specified number of records).\n\n The following example passes `offset=50` to skip the first 50 results,\n but the user only has 10 buckets:\n\n ```sh\n curl --request GET \"INFLUX_URL/api/v2/buckets?limit=1&offset=50\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n ```\n\n The response contains the following:\n\n ```json\n {\n \"links\": {\n \"prev\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=49\\u0026orgID=ORG_ID\",\n \"self\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=50\\u0026orgID=ORG_ID\"\n },\n \"buckets\": []\n }\n ```\n" }, { "name": "Response codes", @@ -6391,7 +6391,7 @@ "Buckets" ], "summary": "List all owners of a bucket", - "description": "Lists all [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nof a bucket.\n\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Lists all [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nof a bucket.\n\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -6467,7 +6467,7 @@ "Buckets" ], "summary": "Add an owner to a bucket", - "description": "Adds an owner to a bucket and returns the [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nwith role and user detail.\n\nUse this endpoint to create a _resource owner_ for the bucket.\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add\n an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Adds an owner to a bucket and returns the [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nwith role and user detail.\n\nUse this endpoint to create a _resource owner_ for the bucket.\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add\n an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -6565,7 +6565,7 @@ "Buckets" ], "summary": "Remove an owner from a bucket", - "description": "Removes an owner from a bucket.\n\nUse this endpoint to remove a user's `owner` role for a bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner\nfrom.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Removes an owner from a bucket.\n\nUse this endpoint to remove a user's `owner` role for a bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner\nfrom.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7121,7 +7121,7 @@ "Security and access endpoints" ], "summary": "List all members of an organization", - "description": "Lists all users that belong to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve\nmembers for.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Lists all users that belong to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve\nmembers for.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7222,7 +7222,7 @@ "Organizations" ], "summary": "Add a member to an organization", - "description": "Add a user to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Add a user to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7321,7 +7321,7 @@ "Security and access endpoints" ], "summary": "Remove a member from an organization", - "description": "Removes a member from an organization.\n\nUse this endpoint to remove a user's member privileges for an organization.\nRemoving member privileges removes the user's `read` and `write` permissions\nfrom the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an\nowner from.\n\n#### Related guides\n\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Removes a member from an organization.\n\nUse this endpoint to remove a user's member privileges for an organization.\nRemoving member privileges removes the user's `read` and `write` permissions\nfrom the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an\nowner from.\n\n#### Related guides\n\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7379,7 +7379,7 @@ "Security and access endpoints" ], "summary": "List all owners of an organization", - "description": "Lists all owners of an organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners from.\n", + "description": "Lists all owners of an organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners from.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7453,7 +7453,7 @@ "Organizations" ], "summary": "Add an owner to an organization", - "description": "Adds an owner to an organization.\n\nUse this endpoint to assign the organization `owner` role to a user.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n", + "description": "Adds an owner to an organization.\n\nUse this endpoint to assign the organization `owner` role to a user.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7543,7 +7543,7 @@ "Security and access endpoints" ], "summary": "Remove an owner from an organization", - "description": "Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from\nthe organization.\n\nOrganization owners have permission to delete organizations and remove user and member\npermissions from the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to\nremove an owner from.\n\n#### Related endpoints\n- [Authorizations](#tag/Authorizations-(API-tokens))\n", + "description": "Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from\nthe organization.\n\nOrganization owners have permission to delete organizations and remove user and member\npermissions from the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to\nremove an owner from.\n\n#### Related endpoints\n- [Authorizations](#tag/Authorizations)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9184,7 +9184,7 @@ "Config" ], "summary": "Retrieve feature flags", - "description": "Retrieves the feature flag key-value pairs configured for the InfluxDB\ninstance.\n_Feature flags_ are configuration options used to develop and test\nexperimental InfluxDB features and are intended for internal use only.\n\nThis endpoint represents the first step in the following three-step process\nto configure feature flags:\n\n1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve\n feature flags and their values.\n2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/#feature-flags).\n3. **Optional**: To confirm that your change is applied, do one of the following:\n\n - Send a request to this endpoint to retrieve the current feature flag values.\n - Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the\n current runtime server configuration.\n\n#### Related guides\n\n- [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/)\n", + "description": "Retrieves the feature flag key-value pairs configured for the InfluxDB\ninstance.\n_Feature flags_ are configuration options used to develop and test\nexperimental InfluxDB features and are intended for internal use only.\n\nThis endpoint represents the first step in the following three-step process\nto configure feature flags:\n\n1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve\n feature flags and their values.\n2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/#feature-flags).\n3. **Optional**: To confirm that your change is applied, do one of the following:\n\n - Send a request to this endpoint to retrieve the current feature flag values.\n - Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the\n current runtime server configuration.\n\n#### Related guides\n\n- [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9370,7 +9370,7 @@ "Tasks" ], "summary": "Add a member to a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9477,7 +9477,7 @@ "Tasks" ], "summary": "List all owners of a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9538,7 +9538,7 @@ "Tasks" ], "summary": "Add an owner for a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9627,7 +9627,7 @@ "Tasks" ], "summary": "Remove an owner from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -11359,77 +11359,66 @@ } } }, - "/authorizations": { + "/users": { "get": { - "operationId": "GetAuthorizations", + "operationId": "GetUsers", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Security and access endpoints", + "Users" ], - "summary": "List authorizations", - "description": "Lists authorizations.\n\nTo limit which authorizations are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all authorizations.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n values in `GET /api/v2/authorizations` responses;\n returns `token: redacted` for all authorizations.\n\n#### Required permissions\n\nTo retrieve an authorization, the request must use an API token that has the\nfollowing permissions:\n\n- `read-authorizations`\n- `read-user` for the user that the authorization is scoped to\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", + "summary": "List users", + "description": "Lists [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\nTo limit which users are returned, pass query parameters in your request.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud doesn't allow listing all users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| List all users | Operator token | InfluxData internal use only |\n| List a specific user | `read-users` or `read-user USER_ID` |\n\n*`USER_ID`* is the ID of the user that you want to retrieve.\n\n#### Related guides\n\n- [Manage users](https://docs.influxdata.com/influxdb/cloud/organizations/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" }, { "in": "query", - "name": "userID", - "schema": { - "type": "string" - }, - "description": "A user ID.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" - }, - { - "in": "query", - "name": "user", - "schema": { - "type": "string" - }, - "description": "A user name.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" - }, - { - "in": "query", - "name": "orgID", - "schema": { - "type": "string" - }, - "description": "An organization ID. Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization)." - }, - { - "in": "query", - "name": "org", + "name": "name", "schema": { "type": "string" }, - "description": "An organization name.\nOnly returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "description": "A user name.\nOnly lists the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" }, { "in": "query", - "name": "token", + "name": "id", "schema": { "type": "string" }, - "description": "An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value.\nSpecifies an authorization by its `token` property value\nand returns the authorization.\n\n#### InfluxDB OSS\n\n- Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter,\n applies other parameters, and then returns the result.\n\n#### Limitations\n\n- The parameter is non-repeatable. If you specify more than one,\n only the first one is used. If a resource with the specified\n property value doesn't exist, then the response body contains an empty list.\n" + "description": "A user id.\nOnly lists the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], "responses": { "200": { - "description": "Success. The response body contains a list of authorizations.\n\nIf the response body is missing authorizations that you expect, check that the API\ntoken used in the request has `read-user` permission for the users (`userID` property value)\nin those authorizations.\n\n#### InfluxDB OSS\n\n- **Warning**: The response body contains authorizations with their\n [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in clear text.\n- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_,\n InfluxDB OSS returns authorizations for all organizations in the instance.\n", + "description": "Success. The response contains a list of `users`.\n\n#### InfluxDB Cloud\n\n- Returns an empty `users` list if you don't pass _`id`_ or _`name`_ parameters and don't use an\n _operator token_.\n Only InfluxData can access InfluxDB Cloud operator tokens.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Authorizations" + "$ref": "#/components/schemas/Users" } } } }, - "400": { - "description": "Invalid request", - "$ref": "#/components/responses/GeneralServerError" - }, "401": { - "$ref": "#/components/responses/AuthorizationError" + "description": "Unauthorized.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Unprocessable entity.\n\nThe error may indicate one of the following problems:\n\n- The request body isn't valid--the request is well-formed,\n but InfluxDB can't process it due to semantic errors.\n- You passed a parameter combination that InfluxDB doesn't support.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, "500": { "$ref": "#/components/responses/InternalServerError" @@ -11441,57 +11430,58 @@ } }, "post": { - "operationId": "PostAuthorizations", + "operationId": "PostUsers", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Users" ], - "summary": "Create an authorization", - "description": "Creates an authorization and returns the authorization with the\ngenerated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token).\n\nUse this endpoint to create an authorization, which generates an API token\nwith permissions to `read` or `write` to a specific resource or `type` of resource.\nThe API token is the authorization's `token` property value.\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB enforces access restrictions on API tokens.\n\n - InfluxDB allows access to the API token value immediately after the authorization is created.\n - You can’t change access (read/write) permissions for an API token after it’s created.\n - Tokens stop working when the user who created the token is deleted.\n\nWe recommend the following for managing your tokens:\n\n - Create a generic user to create and manage tokens for writing data.\n - Store your tokens in a secure password vault for future access.\n\n#### Required permissions\n\n- `write-authorizations`\n- `write-user` for the user that the authorization is scoped to\n\n#### Related guides\n\n- [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n", + "summary": "Create a user", + "description": "(InfluxData internal use only)\n\nCreates and returns a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user)\nthat can access InfluxDB.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Create user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" } ], "requestBody": { - "description": "The authorization to create.", + "description": "In the request body, provide the user.", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthorizationPostRequest" - }, - "examples": { - "AuthorizationPostRequest": { - "$ref": "#/components/examples/AuthorizationPostRequest" - }, - "AuthorizationWithResourcePostRequest": { - "$ref": "#/components/examples/AuthorizationWithResourcePostRequest" - }, - "AuthorizationWithUserPostRequest": { - "$ref": "#/components/examples/AuthorizationWithUserPostRequest" - } + "$ref": "#/components/schemas/User" } } } }, "responses": { "201": { - "description": "Success. The authorization is created. The response body contains the\nauthorization.\n", + "description": "Success.\nThe response body contains the user.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Authorization" + "$ref": "#/components/schemas/UserResponse" } } } }, - "400": { - "description": "Invalid request", - "$ref": "#/components/responses/GeneralServerError" - }, "401": { - "$ref": "#/components/responses/AuthorizationError" + "description": "Unauthorized.\n\n#### InfluxDB Cloud\n\n- Returns this error if the request doesn't use an _operator token_.\n Only InfluxData can access InfluxDB Cloud operator tokens.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Unprocessable entity.\n\nThe error may indicate one of the following problems:\n\n- The request body isn't valid--the request is well-formed,\n but InfluxDB can't process it due to semantic errors.\n- You passed a parameter combination that InfluxDB doesn't support.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, "500": { "$ref": "#/components/responses/InternalServerError" @@ -11503,88 +11493,39 @@ } } }, - "/authorizations/{authID}": { + "/users/{userID}": { "get": { - "operationId": "GetAuthorizationsID", + "operationId": "GetUsersID", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Users" ], - "summary": "Retrieve an authorization", - "description": "Retrieves an authorization.\n\nUse this endpoint to retrieve information about an API token, including\nthe token's permissions and the user that the token is scoped to.\n\n#### InfluxDB OSS\n\n- InfluxDB OSS returns\n [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations.\n- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_,\n InfluxDB OSS returns authorizations for all organizations in the instance.\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", - "externalDocs": { - "url": "{{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/", - "description": "View tokens" - }, + "summary": "Retrieve a user", + "description": "Retrieves a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" }, { "in": "path", - "name": "authID", + "name": "userID", "schema": { "type": "string" }, "required": true, - "description": "An authorization ID. Specifies the authorization to retrieve." + "description": "A user ID.\nRetrieves the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], "responses": { "200": { - "description": "Success. The response body contains the authorization.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Authorization" - } - } - } - }, - "400": { - "description": "Bad request.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The specified resource ID is invalid.\n", - "value": { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/AuthorizationError" - }, - "404": { - "description": "Not found.\n", + "description": "Success. The response body contains the user.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The requested authorization doesn't exist.\n", - "value": { - "code": "not found", - "message": "authorization not found" - } - } + "$ref": "#/components/schemas/UserResponse" } } } }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, "default": { "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" @@ -11592,20 +11533,19 @@ } }, "patch": { - "operationId": "PatchAuthorizationsID", + "operationId": "PatchUsersID", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Users" ], - "summary": "Update an API token to be active or inactive", - "description": "Updates an authorization.\n\nUse this endpoint to set an API token's status to be _active_ or _inactive_.\nInfluxDB rejects requests that use inactive API tokens.\n", + "summary": "Update a user", + "description": "(InfluxData internal use only)\n\nUpdates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) and returns the user.\n\n#### InfluxDB Cloud\n\n- Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Update user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", "requestBody": { - "description": "In the request body, provide the authorization properties to update.", + "description": "The user update to apply.", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/AuthorizationUpdateRequest" + "$ref": "#/components/schemas/User" } } } @@ -11616,235 +11556,182 @@ }, { "in": "path", - "name": "authID", + "name": "userID", "schema": { "type": "string" }, "required": true, - "description": "An authorization ID. Specifies the authorization to update." + "description": "A user ID.\nUpdates the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], "responses": { "200": { - "description": "Success. The response body contains the updated authorization.", + "description": "Success. The response body contains the updated user.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Authorization" + "$ref": "#/components/schemas/UserResponse" } } } }, + "400": { + "$ref": "#/components/responses/BadRequestError" + }, + "401": { + "$ref": "#/components/responses/AuthorizationError" + }, + "404": { + "$ref": "#/components/responses/ResourceNotFoundError" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + }, "default": { - "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" } } }, "delete": { - "operationId": "DeleteAuthorizationsID", + "operationId": "DeleteUsersID", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Users" ], - "summary": "Delete an authorization", - "description": "Deletes an authorization.\n\nUse the endpoint to delete an API token.\n\nIf you want to disable an API token instead of delete it,\n[update the authorization's status to `inactive`](#operation/PatchAuthorizationsID).\n", + "summary": "Delete a user", + "description": "(InfluxData internal use only)\n\nDeletes a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\nFor security purposes, once an InfluxDB user account is deleted from an\norganization, the user (and their token) cannot be reactivated.\n\n#### InfluxDB Cloud\n\n- Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Delete user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" }, { "in": "path", - "name": "authID", + "name": "userID", "schema": { "type": "string" }, "required": true, - "description": "An authorization ID. Specifies the authorization to delete." + "description": "A user ID.\nDeletes the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], "responses": { "204": { - "description": "Success. The authorization is deleted." + "description": "Success. The user is deleted." }, "400": { - "description": "Bad request.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The specified resource ID is invalid.\n", - "value": { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - } - } - } - } + "$ref": "#/components/responses/BadRequestError" }, "401": { "$ref": "#/components/responses/AuthorizationError" }, "404": { - "description": "Not found.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The requested authorization doesn't exist.\n", - "value": { - "code": "not found", - "message": "authorization not found" - } - } - } - } - } + "$ref": "#/components/responses/ResourceNotFoundError" }, "500": { "$ref": "#/components/responses/InternalServerError" }, "default": { - "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" } } } }, - "/users": { + "/setup": { "get": { - "operationId": "GetUsers", + "operationId": "GetSetup", "tags": [ - "Security and access endpoints", - "Users" + "Setup" ], - "summary": "List users", - "description": "Lists [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\nTo limit which users are returned, pass query parameters in your request.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud doesn't allow listing all users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| List all users | Operator token | InfluxData internal use only |\n| List a specific user | `read-users` or `read-user USER_ID` |\n\n*`USER_ID`* is the ID of the user that you want to retrieve.\n\n#### Related guides\n\n- [Manage users](https://docs.influxdata.com/influxdb/cloud/organizations/users/)\n", + "summary": "Retrieve setup status", + "description": "Check if setup is allowed. Returns `true` if no default user, organization, or bucket have been created.", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "query", - "name": "name", - "schema": { - "type": "string" - }, - "description": "A user name.\nOnly lists the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" - }, - { - "in": "query", - "name": "id", - "schema": { - "type": "string" - }, - "description": "A user id.\nOnly lists the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], "responses": { "200": { - "description": "Success. The response contains a list of `users`.\n\n#### InfluxDB Cloud\n\n- Returns an empty `users` list if you don't pass _`id`_ or _`name`_ parameters and don't use an\n _operator token_.\n Only InfluxData can access InfluxDB Cloud operator tokens.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Users" - } - } - } - }, - "401": { - "description": "Unauthorized.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Unprocessable entity.\n\nThe error may indicate one of the following problems:\n\n- The request body isn't valid--the request is well-formed,\n but InfluxDB can't process it due to semantic errors.\n- You passed a parameter combination that InfluxDB doesn't support.\n", + "description": "Setup is allowed, true or false", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/IsOnboarding" } } } - }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" } } }, "post": { - "operationId": "PostUsers", + "operationId": "PostSetup", "tags": [ - "Users" + "Setup" ], - "summary": "Create a user", - "description": "(InfluxData internal use only)\n\nCreates and returns a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user)\nthat can access InfluxDB.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Create user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", + "summary": "Create an initial user, organization, and bucket", + "description": "Post an onboarding request to create an initial user, organization, and bucket.", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" } ], "requestBody": { - "description": "In the request body, provide the user.", + "description": "Source to create", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/User" + "$ref": "#/components/schemas/OnboardingRequest" } } } }, "responses": { "201": { - "description": "Success.\nThe response body contains the user.\n", + "description": "The created default user, bucket, and organization", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserResponse" + "$ref": "#/components/schemas/OnboardingResponse" } } } }, - "401": { - "description": "Unauthorized.\n\n#### InfluxDB Cloud\n\n- Returns this error if the request doesn't use an _operator token_.\n Only InfluxData can access InfluxDB Cloud operator tokens.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + } + }, + "/setup/user": { + "post": { + "operationId": "PostSetupUser", + "tags": [ + "Setup" + ], + "summary": "Create a new user, organization, and bucket", + "description": "Post an onboarding request to create a new user, organization, and bucket.", + "requestBody": { + "description": "Source to create", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OnboardingRequest" } } - }, - "422": { - "description": "Unprocessable entity.\n\nThe error may indicate one of the following problems:\n\n- The request body isn't valid--the request is well-formed,\n but InfluxDB can't process it due to semantic errors.\n- You passed a parameter combination that InfluxDB doesn't support.\n", + } + }, + "responses": { + "201": { + "description": "The created default user, bucket, and organization.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "$ref": "#/components/schemas/OnboardingResponse" } } } }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, "default": { "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" @@ -11852,204 +11739,225 @@ } } }, - "/users/{userID}": { + "/authorizations": { "get": { - "operationId": "GetUsersID", + "operationId": "GetAuthorizations", "tags": [ - "Users" + "Authorizations" ], - "summary": "Retrieve a user", - "description": "Retrieves a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", + "summary": "List authorizations", + "description": "Lists authorizations.\n\nTo limit which authorizations are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all authorizations for the organization.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n values in `GET /api/v2/authorizations` responses;\n returns `token: redacted` for all authorizations.\n\n#### Required permissions\n\n- `read-authorizations`\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" }, { - "in": "path", + "in": "query", "name": "userID", "schema": { "type": "string" }, - "required": true, - "description": "A user ID.\nRetrieves the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" - } - ], - "responses": { - "200": { - "description": "Success. The response body contains the user.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserResponse" - } - } - } + "description": "A user ID.\nOnly returns authorizations scoped to the specified\n[user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - }, - "patch": { - "operationId": "PatchUsersID", - "tags": [ - "Users" - ], - "summary": "Update a user", - "description": "(InfluxData internal use only)\n\nUpdates a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) and returns the user.\n\n#### InfluxDB Cloud\n\n- Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions for InfluxDB Cloud\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Update user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", - "requestBody": { - "description": "The user update to apply.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/User" - } - } - } - }, - "parameters": [ { - "$ref": "#/components/parameters/TraceSpan" + "in": "query", + "name": "user", + "schema": { + "type": "string" + }, + "description": "A user name.\nOnly returns authorizations scoped to the specified\n[user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" }, { - "in": "path", - "name": "userID", + "in": "query", + "name": "orgID", "schema": { "type": "string" }, - "required": true, - "description": "A user ID.\nUpdates the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + "description": "An organization ID.\nOnly returns authorizations that belong to the specified\n[organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + }, + { + "in": "query", + "name": "org", + "schema": { + "type": "string" + }, + "description": "An organization name.\nOnly returns authorizations that belong to the specified\n[organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + }, + { + "in": "query", + "name": "token", + "schema": { + "type": "string" + }, + "description": "An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value.\nReturns the authorization for the specified token.\n" } ], "responses": { "200": { - "description": "Success. The response body contains the updated user.", + "description": "Success. The response body contains a list of authorizations.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UserResponse" + "$ref": "#/components/schemas/Authorizations" } } } }, "400": { - "$ref": "#/components/responses/BadRequestError" + "description": "Invalid request", + "$ref": "#/components/responses/GeneralServerError" }, "401": { "$ref": "#/components/responses/AuthorizationError" }, - "404": { - "$ref": "#/components/responses/ResourceNotFoundError" - }, "500": { "$ref": "#/components/responses/InternalServerError" }, "default": { + "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" } } }, - "delete": { - "operationId": "DeleteUsersID", + "post": { + "operationId": "PostAuthorizations", "tags": [ - "Users" + "Authorizations" ], - "summary": "Delete a user", - "description": "(InfluxData internal use only)\n\nDeletes a [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n\nFor security purposes, once an InfluxDB user account is deleted from an\norganization, the user (and their token) cannot be reactivated.\n\n#### InfluxDB Cloud\n\n- Doesn't let you manage users through the API.\n Use the InfluxDB Cloud user interface (UI) to manage account information.\n\n#### Required permissions\n\n| Action | Permission required | Restriction |\n|:-------|:--------------------|:------------|\n| Delete user | Operator token | InfluxData internal use only |\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/)\n", + "summary": "Create an authorization", + "description": "Creates an authorization and returns the authorization with the\ngenerated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token).\n\nUse this endpoint to create an authorization, which generates an API token\nwith permissions to `read` or `write` to a specific resource or `type` of resource.\n\n#### Limitations\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB Cloud enforces access restrictions on API tokens.\n\n- InfluxDB only allows access to the API token value immediately after the authorization is created.\n- You can't update an authorization's permissions.\n- A token stops working when the user who created the authorization is deleted.\n\nWe recommend the following for managing your tokens:\n\n- Create a generic user to create and manage tokens for writing data.\n- Store your tokens in a secure password vault for future access.\n\n#### Related guides\n\n- [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "path", - "name": "userID", - "schema": { - "type": "string" - }, - "required": true, - "description": "A user ID.\nDeletes the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" } ], + "requestBody": { + "description": "The authorization to create.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthorizationPostRequest" + }, + "examples": { + "AuthorizationPostRequest": { + "$ref": "#/components/examples/AuthorizationPostRequest" + }, + "AuthorizationWithResourcePostRequest": { + "$ref": "#/components/examples/AuthorizationWithResourcePostRequest" + }, + "AuthorizationWithUserPostRequest": { + "$ref": "#/components/examples/AuthorizationWithUserPostRequest" + } + } + } + } + }, "responses": { - "204": { - "description": "Success. The user is deleted." + "201": { + "description": "Success. The authorization is created. The response body contains the authorization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Authorization" + } + } + } }, "400": { - "$ref": "#/components/responses/BadRequestError" + "description": "Invalid request", + "$ref": "#/components/responses/GeneralServerError" }, "401": { "$ref": "#/components/responses/AuthorizationError" }, - "404": { - "$ref": "#/components/responses/ResourceNotFoundError" - }, "500": { "$ref": "#/components/responses/InternalServerError" }, "default": { + "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" } } } }, - "/setup": { + "/authorizations/{authID}": { "get": { - "operationId": "GetSetup", + "operationId": "GetAuthorizationsID", "tags": [ - "Setup" + "Authorizations" ], - "summary": "Retrieve setup status", - "description": "Check if setup is allowed. Returns `true` if no default user, organization, or bucket have been created.", + "summary": "Retrieve an authorization", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The identifier of the authorization to get." } ], "responses": { "200": { - "description": "Setup is allowed, true or false", + "description": "Authorization details", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/IsOnboarding" + "$ref": "#/components/schemas/Authorization" } } } + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" } } }, - "post": { - "operationId": "PostSetup", + "patch": { + "operationId": "PatchAuthorizationsID", "tags": [ - "Setup" - ], - "summary": "Create an initial user, organization, and bucket", - "description": "Post an onboarding request to create an initial user, organization, and bucket.", - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - } + "Authorizations" ], + "summary": "Update authorization status", + "description": "Update an authorization's status to `active` or `inactive`.", "requestBody": { - "description": "Source to create", + "description": "The updated Authorization object.", "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OnboardingRequest" + "$ref": "#/components/schemas/AuthorizationUpdateRequest" } } } }, + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The identifier of the authorization to update." + } + ], "responses": { - "201": { - "description": "The created default user, bucket, and organization", + "200": { + "description": "The updated authorization.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OnboardingResponse" + "$ref": "#/components/schemas/Authorization" } } } @@ -12059,37 +11967,30 @@ "$ref": "#/components/responses/GeneralServerError" } } - } - }, - "/setup/user": { - "post": { - "operationId": "PostSetupUser", + }, + "delete": { + "operationId": "DeleteAuthorizationsID", "tags": [ - "Setup" + "Authorizations" ], - "summary": "Create a new user, organization, and bucket", - "description": "Post an onboarding request to create a new user, organization, and bucket.", - "requestBody": { - "description": "Source to create", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingRequest" - } - } + "summary": "Delete an authorization", + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The identifier of the authorization to delete." } - }, + ], "responses": { - "201": { - "description": "The created default user, bucket, and organization.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OnboardingResponse" - } - } - } + "204": { + "description": "Authorization deleted" }, "default": { "description": "Unexpected error", @@ -14549,7 +14450,7 @@ "AuthorizationUpdateRequest": { "properties": { "status": { - "description": "Status of the token. If `inactive`, InfluxDB rejects requests that use the token.", + "description": "Status of the token. If `inactive`, requests using the token will be rejected.", "default": "active", "type": "string", "enum": [ @@ -14782,7 +14683,7 @@ "shardGroupDurationSeconds": { "type": "integer", "format": "int64", - "description": "The shard group duration.\nThe duration or interval (in seconds) that each shard group covers.\n\n#### InfluxDB Cloud\n\n- Does not use `shardGroupDurationsSeconds`.\n\n#### InfluxDB OSS\n\n- Default value depends on the\n[bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration).\n" + "description": "The shard group duration.\nThe duration or interval (in seconds) that each shard group covers.\n\n#### InfluxDB Cloud\n\n- Does not use `shardGroupDurationsSeconds`.\n\n#### InfluxDB OSS\n\n- Default value depends on the\n[bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration).\n" } }, "required": [ @@ -22222,7 +22123,7 @@ "type": "apiKey", "name": "Authorization", "in": "header", - "description": "Use the [Token authentication](#section/Authentication/TokenAuthentication)\nscheme to authenticate to the InfluxDB API.\n\nIn your API requests, send an `Authorization` header.\nFor the header value, provide the word `Token` followed by a space and an InfluxDB API token.\nThe word `Token` is case-sensitive.\n\n### Syntax\n\n`Authorization: Token INFLUX_API_TOKEN`\n\n### Example\n\n#### Use Token authentication with cURL\n\nThe following example shows how to use cURL to send an API request that uses Token authentication:\n\n```sh\ncurl --request GET \"INFLUX_URL/api/v2/buckets\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n```\n\nReplace the following:\n\n - *`INFLUX_URL`*: your InfluxDB Cloud URL\n - *`INFLUX_API_TOKEN`*: your [InfluxDB API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n\n### Related endpoints\n\n- [`/authorizations` endpoints](#tag/Authorizations-(API-tokens))\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n" + "description": "Use the [Token authentication](#section/Authentication/TokenAuthentication)\nscheme to authenticate to the InfluxDB API.\n\nIn your API requests, send an `Authorization` header.\nFor the header value, provide the word `Token` followed by a space and an InfluxDB API token.\nThe word `Token` is case-sensitive.\n\n### Syntax\n\n`Authorization: Token INFLUX_API_TOKEN`\n\n### Example\n\n#### Use Token authentication with cURL\n\nThe following example shows how to use cURL to send an API request that uses Token authentication:\n\n```sh\ncurl --request GET \"INFLUX_URL/api/v2/buckets\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n```\n\nReplace the following:\n\n - *`INFLUX_URL`*: your InfluxDB Cloud URL\n - *`INFLUX_API_TOKEN`*: your [InfluxDB API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n\n### Related endpoints\n\n- [`/authorizations` endpoints](#tag/Authorizations)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n" }, "BasicAuthentication": { "type": "http", diff --git a/contracts/cloud.yml b/contracts/cloud.yml index 8260a1882..12d7d86aa 100644 --- a/contracts/cloud.yml +++ b/contracts/cloud.yml @@ -10,7 +10,7 @@ info: servers: - url: /api/v2 tags: - - name: Authorizations (API tokens) + - name: Authorizations description: | Create and manage authorizations (API tokens). @@ -18,12 +18,24 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + In InfluxDB Cloud, an authorization with `read-authorizations` permission + can be used to view other authorizations. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + We recommend the following for managing your tokens: - Create a generic user to create and manage tokens for writing data. - Store your tokens in a secure password vault for future access. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If the user signs in with username and password, creating a _user session_, @@ -85,7 +97,7 @@ tags: Use the `/api/v2/scripts` endpoints to create and manage scripts. See related guides to learn how to define parameters and execute scripts. - ### Related guides + #### Related guides - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) from API requests. - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) @@ -114,7 +126,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -122,7 +134,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/cloud/process-data/get-started/) - [Common data processing tasks](https://docs.influxdata.com/influxdb/cloud/process-data/common-tasks/) @@ -145,7 +157,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks](https://docs.influxdata.com/influxdb/cloud/influxdb-templates/stacks/) - [InfluxDB templates](https://docs.influxdata.com/influxdb/cloud/influxdb-templates/) @@ -160,14 +172,14 @@ tags: `GET /api/v2/users` and `GET /api/v2/users/USER_ID` API endpoints to view specific members. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/cloud/organizations/users/) - name: Write @@ -233,7 +245,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records, @@ -5348,7 +5360,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5364,7 +5376,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5429,7 +5441,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5444,7 +5456,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5530,7 +5542,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5546,7 +5558,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -6024,7 +6036,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6121,7 +6133,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6221,7 +6233,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6282,7 +6294,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6343,7 +6355,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6353,7 +6365,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -6428,7 +6440,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6443,7 +6455,7 @@ paths: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7791,7 +7803,7 @@ paths: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/cloud/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/cloud/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -7800,7 +7812,7 @@ paths: #### Related guides - - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/cloud/reference/config-options/) + - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/cloud/influxdb/v2.4/reference/config-options/) parameters: - $ref: '#/components/parameters/TraceSpan' responses: @@ -7963,7 +7975,7 @@ paths: summary: Add a member to a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. parameters: @@ -8036,7 +8048,7 @@ paths: summary: List all owners of a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. parameters: @@ -8088,7 +8100,7 @@ paths: summary: Add an owner for a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. @@ -8161,7 +8173,7 @@ paths: summary: Remove an owner from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -9273,352 +9285,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /authorizations: - get: - operationId: GetAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: List authorizations - description: | - Lists authorizations. - - To limit which authorizations are returned, pass query parameters in your request. - If no query parameters are passed, InfluxDB returns all authorizations. - - #### InfluxDB Cloud - - - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) - values in `GET /api/v2/authorizations` responses; - returns `token: redacted` for all authorizations. - - #### Required permissions - - To retrieve an authorization, the request must use an API token that has the - following permissions: - - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: query - name: userID - schema: - type: string - description: | - A user ID. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). - - in: query - name: user - schema: - type: string - description: | - A user name. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). - - in: query - name: orgID - schema: - type: string - description: 'An organization ID. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization).' - - in: query - name: org - schema: - type: string - description: | - An organization name. - Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). - - in: query - name: token - schema: - type: string - description: | - An API [token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. - responses: - '200': - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorizations' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - post: - operationId: PostAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Create an authorization - description: | - Creates an authorization and returns the authorization with the - generated API [token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token). - - Use this endpoint to create an authorization, which generates an API token - with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. - - To follow best practices for secure API token generation and retrieval, - InfluxDB enforces access restrictions on API tokens. - - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. - - We recommend the following for managing your tokens: - - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions - - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to - - #### Related guides - - - [Create a token](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: The authorization to create. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationPostRequest' - examples: - AuthorizationPostRequest: - $ref: '#/components/examples/AuthorizationPostRequest' - AuthorizationWithResourcePostRequest: - $ref: '#/components/examples/AuthorizationWithResourcePostRequest' - AuthorizationWithUserPostRequest: - $ref: '#/components/examples/AuthorizationWithUserPostRequest' - responses: - '201': - description: | - Success. The authorization is created. The response body contains the - authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - '/authorizations/{authID}': - get: - operationId: GetAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Retrieve an authorization - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/) - externalDocs: - url: 'https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/' - description: View tokens - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to retrieve. - responses: - '200': - description: Success. The response body contains the authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - patch: - operationId: PatchAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Update an API token to be active or inactive - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. - requestBody: - description: 'In the request body, provide the authorization properties to update.' - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationUpdateRequest' - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to update. - responses: - '200': - description: Success. The response body contains the updated authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - delete: - operationId: DeleteAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Delete an authorization - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to delete. - responses: - '204': - description: Success. The authorization is deleted. - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' /users: get: operationId: GetUsers @@ -9981,6 +9647,226 @@ paths: default: description: Unexpected error $ref: '#/components/responses/GeneralServerError' + /authorizations: + get: + operationId: GetAuthorizations + tags: + - Authorizations + summary: List authorizations + description: | + Lists authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations for the organization. + + #### InfluxDB Cloud + + - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) + values in `GET /api/v2/authorizations` responses; + returns `token: redacted` for all authorizations. + + #### Required permissions + + - `read-authorizations` + + #### Related guides + + - [View tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/) + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: query + name: userID + schema: + type: string + description: | + A user ID. + Only returns authorizations scoped to the specified + [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + - in: query + name: user + schema: + type: string + description: | + A user name. + Only returns authorizations scoped to the specified + [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + - in: query + name: orgID + schema: + type: string + description: | + An organization ID. + Only returns authorizations that belong to the specified + [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + - in: query + name: org + schema: + type: string + description: | + An organization name. + Only returns authorizations that belong to the specified + [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + - in: query + name: token + schema: + type: string + description: | + An API [token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) value. + Returns the authorization for the specified token. + responses: + '200': + description: Success. The response body contains a list of authorizations. + content: + application/json: + schema: + $ref: '#/components/schemas/Authorizations' + '400': + description: Invalid request + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + post: + operationId: PostAuthorizations + tags: + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the authorization with the + generated API [token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token). + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB Cloud enforces access restrictions on API tokens. + + - InfluxDB only allows access to the API token value immediately after the authorization is created. + - You can't update an authorization's permissions. + - A token stops working when the user who created the authorization is deleted. + + We recommend the following for managing your tokens: + + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. + + #### Related guides + + - [Create a token](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/) + parameters: + - $ref: '#/components/parameters/TraceSpan' + requestBody: + description: The authorization to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationPostRequest' + examples: + AuthorizationPostRequest: + $ref: '#/components/examples/AuthorizationPostRequest' + AuthorizationWithResourcePostRequest: + $ref: '#/components/examples/AuthorizationWithResourcePostRequest' + AuthorizationWithUserPostRequest: + $ref: '#/components/examples/AuthorizationWithUserPostRequest' + responses: + '201': + description: | + Success. The authorization is created. The response body contains the authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + '400': + description: Invalid request + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + '/authorizations/{authID}': + get: + operationId: GetAuthorizationsID + tags: + - Authorizations + summary: Retrieve an authorization + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to get. + responses: + '200': + description: Authorization details + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + patch: + operationId: PatchAuthorizationsID + tags: + - Authorizations + summary: Update authorization status + description: Update an authorization's status to `active` or `inactive`. + requestBody: + description: The updated Authorization object. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationUpdateRequest' + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to update. + responses: + '200': + description: The updated authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + delete: + operationId: DeleteAuthorizationsID + tags: + - Authorizations + summary: Delete an authorization + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to delete. + responses: + '204': + description: Authorization deleted + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' /variables: get: operationId: GetVariables @@ -12020,7 +11906,7 @@ components: AuthorizationUpdateRequest: properties: status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' default: active type: string enum: @@ -12261,7 +12147,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period](https://docs.influxdata.com/influxdb/cloud/reference/internals/shards/#shard-group-duration). + [bucket retention period](https://docs.influxdata.com/influxdb/cloud/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds Link: @@ -17617,7 +17503,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/contracts/common.yml b/contracts/common.yml index 0eff9688b..bb42f5f28 100644 --- a/contracts/common.yml +++ b/contracts/common.yml @@ -5057,7 +5057,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5073,7 +5073,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5138,7 +5138,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5153,7 +5153,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5239,7 +5239,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5255,7 +5255,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5733,7 +5733,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5830,7 +5830,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5930,7 +5930,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5991,7 +5991,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6052,7 +6052,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6062,7 +6062,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -6137,7 +6137,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6152,7 +6152,7 @@ paths: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7500,7 +7500,7 @@ paths: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -7509,7 +7509,7 @@ paths: #### Related guides - - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/reference/config-options/) + - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/) parameters: - $ref: '#/components/parameters/TraceSpan' responses: @@ -7672,7 +7672,7 @@ paths: summary: Add a member to a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. parameters: @@ -7745,7 +7745,7 @@ paths: summary: List all owners of a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. parameters: @@ -7797,7 +7797,7 @@ paths: summary: Add an owner for a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. @@ -7870,7 +7870,7 @@ paths: summary: Remove an owner from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -8982,379 +8982,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /authorizations: - get: - operationId: GetAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: List authorizations - description: | - Lists authorizations. - - To limit which authorizations are returned, pass query parameters in your request. - If no query parameters are passed, InfluxDB returns all authorizations. - - #### InfluxDB Cloud - - - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) - values in `GET /api/v2/authorizations` responses; - returns `token: redacted` for all authorizations. - - #### Required permissions - - To retrieve an authorization, the request must use an API token that has the - following permissions: - - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: query - name: userID - schema: - type: string - description: | - A user ID. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). - - in: query - name: user - schema: - type: string - description: | - A user name. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). - - in: query - name: orgID - schema: - type: string - description: 'An organization ID. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization).' - - in: query - name: org - schema: - type: string - description: | - An organization name. - Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). - - in: query - name: token - schema: - type: string - description: | - An API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. - responses: - '200': - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorizations' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - post: - operationId: PostAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Create an authorization - description: | - Creates an authorization and returns the authorization with the - generated API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token). - - Use this endpoint to create an authorization, which generates an API token - with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. - - To follow best practices for secure API token generation and retrieval, - InfluxDB enforces access restrictions on API tokens. - - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. - - We recommend the following for managing your tokens: - - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions - - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to - - #### Related guides - - - [Create a token](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: The authorization to create. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationPostRequest' - examples: - AuthorizationPostRequest: - summary: An authorization for a resource type - description: Creates an authorization. - value: - orgID: INFLUX_ORG_ID - description: iot_users read buckets - permissions: - - action: read - resource: - type: buckets - AuthorizationWithResourcePostRequest: - summary: An authorization for a resource - description: Creates an authorization for access to a specific resource. - value: - orgID: INFLUX_ORG_ID - description: iot_users read buckets - permissions: - - action: read - resource: - type: buckets - id: INFLUX_BUCKET_ID - AuthorizationWithUserPostRequest: - summary: An authorization scoped to a user - description: Creates an authorization scoped to a specific user. - value: - orgID: INFLUX_ORG_ID - userID: INFLUX_USER_ID - description: iot_user write to bucket - permissions: - - action: write - resource: - type: buckets - id: INFLUX_BUCKET_ID - responses: - '201': - description: | - Success. The authorization is created. The response body contains the - authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - '/authorizations/{authID}': - get: - operationId: GetAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Retrieve an authorization - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) - externalDocs: - url: 'https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/' - description: View tokens - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to retrieve. - responses: - '200': - description: Success. The response body contains the authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - patch: - operationId: PatchAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Update an API token to be active or inactive - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. - requestBody: - description: 'In the request body, provide the authorization properties to update.' - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationUpdateRequest' - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to update. - responses: - '200': - description: Success. The response body contains the updated authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - delete: - operationId: DeleteAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Delete an authorization - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to delete. - responses: - '204': - description: Success. The authorization is deleted. - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' components: parameters: TraceSpan: @@ -10127,7 +9754,7 @@ components: AuthorizationUpdateRequest: properties: status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' default: active type: string enum: @@ -10368,7 +9995,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period](https://docs.influxdata.com/influxdb/latest/reference/internals/shards/#shard-group-duration). + [bucket retention period](https://docs.influxdata.com/influxdb/latest/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds Link: diff --git a/contracts/legacy.yml b/contracts/legacy.yml index 591ceb189..36c031482 100644 --- a/contracts/legacy.yml +++ b/contracts/legacy.yml @@ -520,18 +520,18 @@ components: properties: orgID: type: string - description: The organization ID. Identifies the organization that the authorization is scoped to. + description: The ID of the organization that the authorization is scoped to. userID: type: string - description: The user ID. Identifies the user that the authorization is scoped to. + description: The ID of the user that the authorization is scoped to. token: type: string - description: The name that you provide for the authorization. + description: A name that you provide for the authorization. permissions: type: array minItems: 1 description: | - The list of permissions that provide `read` and `write` access to organization resources. + A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. items: $ref: '#/components/schemas/Permission' @@ -653,7 +653,7 @@ components: AuthorizationUpdateRequest: properties: status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' default: active type: string enum: diff --git a/contracts/oss-diff.yml b/contracts/oss-diff.yml index 92c8b4878..a2d636352 100644 --- a/contracts/oss-diff.yml +++ b/contracts/oss-diff.yml @@ -1341,6 +1341,332 @@ paths: default: description: Unexpected error $ref: '#/paths/~1config/get/responses/401' + /authorizations: + get: + operationId: GetAuthorizations + tags: + - Authorizations + - Security and access endpoints + summary: List authorizations + description: | + Lists authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations. + + #### InfluxDB OSS + + - InfluxDB OSS returns + [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations. + - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. + + #### Required permissions + + - An _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + + #### Related guides + + - [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) + parameters: + - $ref: '#/paths/~1ready/get/parameters/0' + - in: query + name: userID + schema: + type: string + description: | + A user ID. + Only returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: user + schema: + type: string + description: | + A user name. + Only returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: orgID + schema: + type: string + description: 'An organization ID. Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).' + - in: query + name: org + schema: + type: string + description: | + An organization name. + Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + responses: + '200': + description: Success. The response body contains a list of authorizations. + content: + application/json: + schema: + type: object + properties: + links: + readOnly: true + $ref: '#/paths/~1dashboards/get/responses/200/content/application~1json/schema/properties/links' + authorizations: + type: array + items: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + '400': + description: Invalid request + $ref: '#/paths/~1config/get/responses/401' + '401': + $ref: '#/paths/~1tasks/get/responses/401' + '500': + $ref: '#/paths/~1users/get/responses/500' + default: + description: Unexpected error + $ref: '#/paths/~1config/get/responses/401' + post: + operationId: PostAuthorizations + tags: + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the authorization with the + generated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token). + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + The response contains the new authorization with the generated API token. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_. + - You can't update an authorization's permissions. + - Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + - A token stops working when the user who created the authorization is deleted. + + We recommend creating a generic user to create and manage tokens for writing data. + + #### Related guides + + - [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/) + parameters: + - $ref: '#/paths/~1ready/get/parameters/0' + requestBody: + description: The authorization to create. + required: true + content: + application/json: + schema: + required: + - orgID + - permissions + allOf: + - $ref: '#/paths/~1authorizations~1%7BauthID%7D/patch/requestBody/content/application~1json/schema' + - type: object + properties: + orgID: + type: string + description: | + An organization ID. + Specifies the organization that owns the authorization. + userID: + type: string + description: | + A user ID. + Specifies the user that the authorization is scoped to. + + When a user authenticates with username and password, + InfluxDB generates a _user session_ with all the permissions + specified by all the user's authorizations. + permissions: + type: array + minItems: 1 + description: | + A list of permissions for an authorization. + In the list, provide at least one `permission` object. + + In a `permission`, the `resource.type` property grants access to all + resources of the specified type. + To grant access to only a specific resource, specify the + `resource.id` property. + items: + required: + - action + - resource + properties: + action: + type: string + enum: + - read + - write + resource: + type: object + required: + - type + properties: + type: + type: string + enum: + - authorizations + - buckets + - dashboards + - orgs + - tasks + - telegrafs + - users + - variables + - secrets + - labels + - views + - documents + - notificationRules + - notificationEndpoints + - checks + - dbrp + - annotations + - sources + - scrapers + - notebooks + - remotes + - replications + - instance + - flows + - functions + - subscriptions + description: | + A resource type. + Identifies the API resource's type (or _kind_). + id: + type: string + description: | + A resource ID. + Identifies a specific resource. + name: + type: string + description: | + The name of the resource. + _Note: not all resource types have a `name` property_. + orgID: + type: string + description: | + An organization ID. + Identifies the organization that owns the resource. + org: + type: string + description: | + An organization name. + The organization that owns the resource. + examples: + AuthorizationPostRequest: + $ref: '#/components/examples/AuthorizationPostRequest' + AuthorizationWithResourcePostRequest: + $ref: '#/components/examples/AuthorizationWithResourcePostRequest' + AuthorizationWithUserPostRequest: + $ref: '#/components/examples/AuthorizationWithUserPostRequest' + responses: + '201': + description: | + Success. The authorization is created. The response body contains the authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + '400': + description: Invalid request + $ref: '#/paths/~1config/get/responses/401' + '401': + $ref: '#/paths/~1tasks/get/responses/401' + '500': + $ref: '#/paths/~1users/get/responses/500' + default: + description: Unexpected error + $ref: '#/paths/~1config/get/responses/401' + '/authorizations/{authID}': + get: + operationId: GetAuthorizationsID + tags: + - Authorizations + - Security and access endpoints + summary: Retrieve an authorization + parameters: + - $ref: '#/paths/~1ready/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to get. + responses: + '200': + description: Authorization details + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + default: + description: Unexpected error + $ref: '#/paths/~1config/get/responses/401' + patch: + operationId: PatchAuthorizationsID + tags: + - Authorizations + summary: Update an authorization to be active or inactive + requestBody: + description: Authorization to update + required: true + content: + application/json: + schema: + properties: + status: + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' + default: active + type: string + enum: + - active + - inactive + description: + type: string + description: A description of the token. + parameters: + - $ref: '#/paths/~1ready/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to update. + responses: + '200': + description: The active or inactive authorization + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse/properties/auth' + default: + description: Unexpected error + $ref: '#/paths/~1config/get/responses/401' + delete: + operationId: DeleteAuthorizationsID + tags: + - Authorizations + summary: Delete an authorization + parameters: + - $ref: '#/paths/~1ready/get/parameters/0' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to delete. + responses: + '204': + description: Authorization deleted + default: + description: Unexpected error + $ref: '#/paths/~1config/get/responses/401' /variables: get: operationId: GetVariables @@ -5431,7 +5757,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). + [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds labels: @@ -5444,17 +5770,7 @@ components: - orgID - permissions allOf: - - properties: - status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' - default: active - type: string - enum: - - active - - inactive - description: - type: string - description: A description of the token. + - $ref: '#/paths/~1authorizations~1%7BauthID%7D/patch/requestBody/content/application~1json/schema' - type: object properties: createdAt: @@ -5477,72 +5793,7 @@ components: The list of permissions. An authorization must have at least one permission. items: - required: - - action - - resource - properties: - action: - type: string - enum: - - read - - write - resource: - type: object - required: - - type - properties: - type: - type: string - enum: - - authorizations - - buckets - - dashboards - - orgs - - tasks - - telegrafs - - users - - variables - - secrets - - labels - - views - - documents - - notificationRules - - notificationEndpoints - - checks - - dbrp - - annotations - - sources - - scrapers - - notebooks - - remotes - - replications - - instance - - flows - - functions - - subscriptions - description: | - A resource type. - Identifies the API resource's type (or _kind_). - id: - type: string - description: | - A resource ID. - Identifies a specific resource. - name: - type: string - description: | - The name of the resource. - _Note: not all resource types have a `name` property_. - orgID: - type: string - description: | - An organization ID. - Identifies the organization that owns the resource. - org: - type: string - description: | - An organization name. - The organization that owns the resource. + $ref: '#/paths/~1authorizations/post/requestBody/content/application~1json/schema/allOf/1/properties/permissions/items' id: readOnly: true type: string @@ -6449,7 +6700,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/contracts/oss.json b/contracts/oss.json index 08b1aebf4..da5beb286 100644 --- a/contracts/oss.json +++ b/contracts/oss.json @@ -16,8 +16,8 @@ ], "tags": [ { - "name": "Authorizations (API tokens)", - "description": "Create and manage authorizations (API tokens).\n\nAn _authorization_ contains a list of `read` and `write`\npermissions for organization resources and provides an API token for authentication.\nAn authorization belongs to an organization and only contains permissions for that organization.\n\nWe recommend creating a generic user to create and manage tokens for writing data.\n\n### User sessions with authorizations\n\nOptionally, when creating an authorization, you can scope it to a specific user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nFor more information, see [how to assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/).\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related endpoints\n\n- [Signin](#tag/Signin)\n- [Signout](#tag/Signout)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n- [Assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n" + "name": "Authorizations", + "description": "Create and manage authorizations (API tokens).\n\nAn _authorization_ contains a list of `read` and `write`\npermissions for organization resources and provides an API token for authentication.\nAn authorization belongs to an organization and only contains permissions for that organization.\n\n#### Limitations\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB enforces access restrictions on API tokens.\n\n- InfluxDB allows access to the API token value immediately after the authorization is created.\n- You can’t change access (read/write) permissions for an API token after it’s created.\n- Tokens stop working when the user who created the token is deleted.\n\nAPI tokens are visible to the user who created the authorization and to any\nuser with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_.\nIn InfluxDB OSS, even if an API token has `read-authorizations` permission, the\ntoken can't be used to view its authorization details.\n\nWe recommend creating a generic user to create and manage tokens for writing data.\n\n#### User sessions with authorizations\n\nOptionally, when creating an authorization, you can scope it to a specific user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nFor more information, see [how to assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/).\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related endpoints\n\n- [Signin](#tag/Signin)\n- [Signout](#tag/Signout)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n- [Assign a token to a specific user]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n" }, { "name": "Buckets", @@ -45,15 +45,15 @@ }, { "name": "Tasks", - "description": "Process and analyze your data with [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nin the InfluxDB task engine.\nUse the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs.\n\nTo configure a task, provide the script and the schedule to run the task.\nFor examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks).\n\n\n\n### Properties\n\nA `task` object contains information about an InfluxDB task resource.\n\nThe following table defines the properties that appear in a `task` object:\n\n\n\n### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n" + "description": "Process and analyze your data with [tasks]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#task)\nin the InfluxDB task engine.\nUse the `/api/v2/tasks` endpoints to schedule and manage tasks, retry task runs, and retrieve run logs.\n\nTo configure a task, provide the script and the schedule to run the task.\nFor examples, see how to create a task with the [`POST /api/v2/tasks` endpoint](#operation/PostTasks).\n\n\n\n#### Properties\n\nA `task` object contains information about an InfluxDB task resource.\n\nThe following table defines the properties that appear in a `task` object:\n\n\n\n#### Related guides\n\n- [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/)\n- [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/)\n" }, { "name": "Templates", - "description": "Export and apply InfluxDB **templates**.\nManage **stacks** of templated InfluxDB resources.\n\nInfluxDB templates are prepackaged configurations for\neverything from dashboards and Telegraf to notifications and alerts.\nUse InfluxDB templates to quickly configure a fresh instance of InfluxDB,\nback up your dashboard configuration, or share your configuration with the\nInfluxData community.\n\nUse the `/api/v2/templates` endpoints to export templates and apply templates.\n\n**InfluxDB stacks** are stateful InfluxDB templates that let you\nadd, update, and remove installed template resources over time, avoid duplicating\nresources when applying the same or similar templates more than once, and\napply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud.\n\nUse the `/api/v2/stacks` endpoints to manage installed template resources.\n\n### Related guides\n\n- [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/)\n- [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/)\n" + "description": "Export and apply InfluxDB **templates**.\nManage **stacks** of templated InfluxDB resources.\n\nInfluxDB templates are prepackaged configurations for\neverything from dashboards and Telegraf to notifications and alerts.\nUse InfluxDB templates to quickly configure a fresh instance of InfluxDB,\nback up your dashboard configuration, or share your configuration with the\nInfluxData community.\n\nUse the `/api/v2/templates` endpoints to export templates and apply templates.\n\n**InfluxDB stacks** are stateful InfluxDB templates that let you\nadd, update, and remove installed template resources over time, avoid duplicating\nresources when applying the same or similar templates more than once, and\napply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud.\n\nUse the `/api/v2/stacks` endpoints to manage installed template resources.\n\n#### Related guides\n\n- [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/)\n- [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/)\n" }, { "name": "Users", - "description": "Manage users for your organization.\nUsers are those with access to InfluxDB.\nTo grant a user permission to access data, add them as a member of an\norganization and provide them with an API token.\n\n### User sessions with authorizations\n\nOptionally, you can scope an authorization (and its API token) to a user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/influxdb/latest/users/)\n- [Create a token scoped to a user]({{% INFLUXDB_DOCS_URL %}}/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user)\n" + "description": "Manage users for your organization.\nUsers are those with access to InfluxDB.\nTo grant a user permission to access data, add them as a member of an\norganization and provide them with an API token.\n\n#### User sessions with authorizations\n\nOptionally, you can scope an authorization (and its API token) to a user.\nIf a user signs in with username and password, creating a _user session_,\nthe session carries the permissions granted by all the user's authorizations.\nTo create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin).\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/influxdb/latest/users/)\n- [Create a token scoped to a user]({{% INFLUXDB_DOCS_URL %}}/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user)\n" }, { "name": "Write", @@ -87,7 +87,7 @@ { "name": "Pagination", "x-traitTag": true, - "description": "Some InfluxDB API [list operations](#tag/SupportedOperations) may support the following query parameters for paginating results:\n\n| Query parameter | Value type | Description |\n|:------------------------ |:--------------------- |:-------------------------------------------|\n| `limit` | integer | The maximum number of records to return (after other parameters are applied). |\n| `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). |\n| `after` | string (resource ID) | Only returns resources created after the specified resource. |\n\n### Limitations\n\n- For specific endpoint parameters and examples, see the endpoint definition.\n- If you specify an `offset` parameter value greater than the total number of records,\n then InfluxDB returns an empty list in the response\n (given `offset` skips the specified number of records).\n\n The following example passes `offset=50` to skip the first 50 results,\n but the user only has 10 buckets:\n\n ```sh\n curl --request GET \"INFLUX_URL/api/v2/buckets?limit=1&offset=50\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n ```\n\n The response contains the following:\n\n ```json\n {\n \"links\": {\n \"prev\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=49\\u0026orgID=ORG_ID\",\n \"self\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=50\\u0026orgID=ORG_ID\"\n },\n \"buckets\": []\n }\n ```\n" + "description": "Some InfluxDB API [list operations](#tag/SupportedOperations) may support the following query parameters for paginating results:\n\n| Query parameter | Value type | Description |\n|:------------------------ |:--------------------- |:-------------------------------------------|\n| `limit` | integer | The maximum number of records to return (after other parameters are applied). |\n| `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). |\n| `after` | string (resource ID) | Only returns resources created after the specified resource. |\n\n#### Limitations\n\n- For specific endpoint parameters and examples, see the endpoint definition.\n- If you specify an `offset` parameter value greater than the total number of records,\n then InfluxDB returns an empty list in the response\n (given `offset` skips the specified number of records).\n\n The following example passes `offset=50` to skip the first 50 results,\n but the user only has 10 buckets:\n\n ```sh\n curl --request GET \"INFLUX_URL/api/v2/buckets?limit=1&offset=50\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n ```\n\n The response contains the following:\n\n ```json\n {\n \"links\": {\n \"prev\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=49\\u0026orgID=ORG_ID\",\n \"self\": \"/api/v2/buckets?descending=false\\u0026limit=1\\u0026offset=50\\u0026orgID=ORG_ID\"\n },\n \"buckets\": []\n }\n ```\n" }, { "name": "Response codes", @@ -6392,7 +6392,7 @@ "Buckets" ], "summary": "List all owners of a bucket", - "description": "Lists all [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nof a bucket.\n\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Lists all [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nof a bucket.\n\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -6468,7 +6468,7 @@ "Buckets" ], "summary": "Add an owner to a bucket", - "description": "Adds an owner to a bucket and returns the [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nwith role and user detail.\n\nUse this endpoint to create a _resource owner_ for the bucket.\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add\n an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Adds an owner to a bucket and returns the [owners]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner)\nwith role and user detail.\n\nUse this endpoint to create a _resource owner_ for the bucket.\nBucket owners have permission to delete buckets and remove user and member\npermissions from the bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add\n an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -6566,7 +6566,7 @@ "Buckets" ], "summary": "Remove an owner from a bucket", - "description": "Removes an owner from a bucket.\n\nUse this endpoint to remove a user's `owner` role for a bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner\nfrom.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", + "description": "Removes an owner from a bucket.\n\nUse this endpoint to remove a user's `owner` role for a bucket.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an owner\nfrom.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7122,7 +7122,7 @@ "Security and access endpoints" ], "summary": "List all members of an organization", - "description": "Lists all users that belong to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve\nmembers for.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Lists all users that belong to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve\nmembers for.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7223,7 +7223,7 @@ "Organizations" ], "summary": "Add a member to an organization", - "description": "Add a user to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Add a user to an organization.\n\nInfluxDB [users]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user) have\npermission to access InfluxDB.\n\n[Members]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#member) are users\nwithin the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add a member to.\n\n#### Related guides\n\n- [Manage users]({{% INFLUXDB_DOCS_URL %}}/users/)\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7322,7 +7322,7 @@ "Security and access endpoints" ], "summary": "Remove a member from an organization", - "description": "Removes a member from an organization.\n\nUse this endpoint to remove a user's member privileges for an organization.\nRemoving member privileges removes the user's `read` and `write` permissions\nfrom the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an\nowner from.\n\n#### Related guides\n\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", + "description": "Removes a member from an organization.\n\nUse this endpoint to remove a user's member privileges for an organization.\nRemoving member privileges removes the user's `read` and `write` permissions\nfrom the organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Member permissions are separate from API token permissions.\n- Member permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to remove an\nowner from.\n\n#### Related guides\n\n- [Manage members]({{% INFLUXDB_DOCS_URL %}}/organizations/members/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7380,7 +7380,7 @@ "Security and access endpoints" ], "summary": "List all owners of an organization", - "description": "Lists all owners of an organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners from.\n", + "description": "Lists all owners of an organization.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Required permissions\n\n- `read-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to retrieve a\nlist of owners from.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7454,7 +7454,7 @@ "Organizations" ], "summary": "Add an owner to an organization", - "description": "Adds an owner to an organization.\n\nUse this endpoint to assign the organization `owner` role to a user.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations-(API-tokens))\n", + "description": "Adds an owner to an organization.\n\nUse this endpoint to assign the organization `owner` role to a user.\n\n#### InfluxDB Cloud\n\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to add an owner for.\n\n#### Related endpoints\n\n- [Authorizations](#tag/Authorizations)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -7544,7 +7544,7 @@ "Security and access endpoints" ], "summary": "Remove an owner from an organization", - "description": "Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from\nthe organization.\n\nOrganization owners have permission to delete organizations and remove user and member\npermissions from the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to\nremove an owner from.\n\n#### Related endpoints\n- [Authorizations](#tag/Authorizations-(API-tokens))\n", + "description": "Removes an [owner]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#owner) from\nthe organization.\n\nOrganization owners have permission to delete organizations and remove user and member\npermissions from the organization.\n\n#### InfluxDB Cloud\n- Doesn't use `owner` and `member` roles.\n Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\n#### Limitations\n\n- Owner permissions are separate from API token permissions.\n- Owner permissions are used in the context of the InfluxDB UI.\n\n#### Required permissions\n\n- `write-orgs INFLUX_ORG_ID`\n\n*`INFLUX_ORG_ID`* is the ID of the organization that you want to\nremove an owner from.\n\n#### Related endpoints\n- [Authorizations](#tag/Authorizations)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9185,7 +9185,7 @@ "Config" ], "summary": "Retrieve feature flags", - "description": "Retrieves the feature flag key-value pairs configured for the InfluxDB\ninstance.\n_Feature flags_ are configuration options used to develop and test\nexperimental InfluxDB features and are intended for internal use only.\n\nThis endpoint represents the first step in the following three-step process\nto configure feature flags:\n\n1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve\n feature flags and their values.\n2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/#feature-flags).\n3. **Optional**: To confirm that your change is applied, do one of the following:\n\n - Send a request to this endpoint to retrieve the current feature flag values.\n - Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the\n current runtime server configuration.\n\n#### Related guides\n\n- [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/)\n", + "description": "Retrieves the feature flag key-value pairs configured for the InfluxDB\ninstance.\n_Feature flags_ are configuration options used to develop and test\nexperimental InfluxDB features and are intended for internal use only.\n\nThis endpoint represents the first step in the following three-step process\nto configure feature flags:\n\n1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve\n feature flags and their values.\n2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/#feature-flags).\n3. **Optional**: To confirm that your change is applied, do one of the following:\n\n - Send a request to this endpoint to retrieve the current feature flag values.\n - Send a request to the [`GET /api/v2/config` endpoint](#operation/GetConfig) to retrieve the\n current runtime server configuration.\n\n#### Related guides\n\n- [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/)\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9371,7 +9371,7 @@ "Tasks" ], "summary": "Add a member to a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nAdds a user to members of a task and returns the member.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9478,7 +9478,7 @@ "Tasks" ], "summary": "List all owners of a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nRetrieves all users that have owner permission for a task.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9539,7 +9539,7 @@ "Tasks" ], "summary": "Add an owner for a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n\nAssigns a task `owner` role to a user.\n\nUse this endpoint to create a _resource owner_ for the task.\nA _resource owner_ is a user with `role: owner` for a specific resource.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -9628,7 +9628,7 @@ "Tasks" ], "summary": "Remove an owner from a task", - "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions.\n", + "description": "**Deprecated**: Tasks don't use `owner` and `member` roles.\nUse [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions.\n", "parameters": [ { "$ref": "#/components/parameters/TraceSpan" @@ -11360,143 +11360,150 @@ } } }, - "/authorizations": { + "/debug/pprof/all": { "get": { - "operationId": "GetAuthorizations", + "operationId": "GetDebugPprofAllProfiles", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Debug", + "System information endpoints" ], - "summary": "List authorizations", - "description": "Lists authorizations.\n\nTo limit which authorizations are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all authorizations.\n\n#### InfluxDB Cloud\n\n- InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n values in `GET /api/v2/authorizations` responses;\n returns `token: redacted` for all authorizations.\n\n#### Required permissions\n\nTo retrieve an authorization, the request must use an API token that has the\nfollowing permissions:\n\n- `read-authorizations`\n- `read-user` for the user that the authorization is scoped to\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, + "summary": "Retrieve all runtime profiles", + "description": "Collects samples and returns reports for the following [Go runtime profiles](https://pkg.go.dev/runtime/pprof):\n\n- **allocs**: All past memory allocations\n- **block**: Stack traces that led to blocking on synchronization primitives\n- **cpu**: (Optional) Program counters sampled from the executing stack.\n Include by passing the `cpu` query parameter with a [duration]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#duration) value.\n Equivalent to the report from [`GET /debug/pprof/profile?seconds=NUMBER_OF_SECONDS`](#operation/GetDebugPprofProfile).\n- **goroutine**: All current goroutines\n- **heap**: Memory allocations for live objects\n- **mutex**: Holders of contended mutexes\n- **threadcreate**: Stack traces that led to the creation of new OS threads\n", + "x-codeSamples": [ { - "in": "query", - "name": "userID", - "schema": { - "type": "string" - }, - "description": "A user ID.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + "lang": "Shell", + "label": "Shell: Get all profiles", + "source": "# Download and extract a `tar.gz` of all profiles after 10 seconds of CPU sampling.\n\ncurl \"http://localhost:8086/debug/pprof/all?cpu=10s\" | tar -xz\n\n# x profiles/cpu.pb.gz\n# x profiles/goroutine.pb.gz\n# x profiles/block.pb.gz\n# x profiles/mutex.pb.gz\n# x profiles/heap.pb.gz\n# x profiles/allocs.pb.gz\n# x profiles/threadcreate.pb.gz\n\n# Analyze a profile.\n\ngo tool pprof profiles/heap.pb.gz\n" }, { - "in": "query", - "name": "user", - "schema": { - "type": "string" - }, - "description": "A user name.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" - }, + "lang": "Shell", + "label": "Shell: Get all profiles except CPU", + "source": "# Download and extract a `tar.gz` of all profiles except CPU.\n\ncurl http://localhost:8086/debug/pprof/all | tar -xz\n\n# x profiles/goroutine.pb.gz\n# x profiles/block.pb.gz\n# x profiles/mutex.pb.gz\n# x profiles/heap.pb.gz\n# x profiles/allocs.pb.gz\n# x profiles/threadcreate.pb.gz\n\n# Analyze a profile.\n\ngo tool pprof profiles/heap.pb.gz\n" + } + ], + "servers": [ { - "in": "query", - "name": "orgID", - "schema": { - "type": "string" - }, - "description": "An organization ID. Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization)." - }, + "url": "" + } + ], + "parameters": [ { - "in": "query", - "name": "org", - "schema": { - "type": "string" - }, - "description": "An organization name.\nOnly returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + "$ref": "#/components/parameters/TraceSpan" }, { "in": "query", - "name": "token", + "name": "cpu", + "description": "Collects and returns CPU profiling data for the specified [duration]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#duration).\n", "schema": { - "type": "string" - }, - "description": "An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value.\nSpecifies an authorization by its `token` property value\nand returns the authorization.\n\n#### InfluxDB OSS\n\n- Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter,\n applies other parameters, and then returns the result.\n\n#### Limitations\n\n- The parameter is non-repeatable. If you specify more than one,\n only the first one is used. If a resource with the specified\n property value doesn't exist, then the response body contains an empty list.\n" + "type": "string", + "format": "duration", + "externalDocs": { + "description": "InfluxDB duration", + "url": "https://docs.influxdata.com/influxdb/latest/reference/glossary/#duration" + } + } } ], "responses": { "200": { - "description": "Success. The response body contains a list of authorizations.\n\nIf the response body is missing authorizations that you expect, check that the API\ntoken used in the request has `read-user` permission for the users (`userID` property value)\nin those authorizations.\n\n#### InfluxDB OSS\n\n- **Warning**: The response body contains authorizations with their\n [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in clear text.\n- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_,\n InfluxDB OSS returns authorizations for all organizations in the instance.\n", + "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) reports.\n", "content": { - "application/json": { + "application/octet-stream": { "schema": { - "$ref": "#/components/schemas/Authorizations" + "description": "GZIP compressed TAR file (`.tar.gz`) that contains\n[Go runtime profile](https://pkg.go.dev/runtime/pprof) reports.\n", + "type": "string", + "format": "binary", + "externalDocs": { + "description": "Golang pprof package", + "url": "https://pkg.go.dev/net/http/pprof" + } } } } }, - "400": { - "description": "Invalid request", - "$ref": "#/components/responses/GeneralServerError" - }, - "401": { - "$ref": "#/components/responses/AuthorizationError" - }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, "default": { "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" } } - }, - "post": { - "operationId": "PostAuthorizations", + } + }, + "/debug/pprof/allocs": { + "get": { + "operationId": "GetDebugPprofAllocs", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Debug", + "System information endpoints" ], - "summary": "Create an authorization", - "description": "Creates an authorization and returns the authorization with the\ngenerated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token).\n\nUse this endpoint to create an authorization, which generates an API token\nwith permissions to `read` or `write` to a specific resource or `type` of resource.\nThe API token is the authorization's `token` property value.\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB enforces access restrictions on API tokens.\n\n - InfluxDB allows access to the API token value immediately after the authorization is created.\n - You can’t change access (read/write) permissions for an API token after it’s created.\n - Tokens stop working when the user who created the token is deleted.\n\nWe recommend the following for managing your tokens:\n\n - Create a generic user to create and manage tokens for writing data.\n - Store your tokens in a secure password vault for future access.\n\n#### Required permissions\n\n- `write-authorizations`\n- `write-user` for the user that the authorization is scoped to\n\n#### Related guides\n\n- [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n", - "parameters": [ + "summary": "Retrieve the memory allocations runtime profile", + "description": "Returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of\nall past memory allocations.\n**allocs** is the same as the **heap** profile,\nbut changes the default [pprof](https://pkg.go.dev/runtime/pprof)\ndisplay to __-alloc_space__,\nthe total number of bytes allocated since the program began (including garbage-collected bytes).\n", + "x-codeSamples": [ { - "$ref": "#/components/parameters/TraceSpan" + "lang": "Shell", + "label": "Shell: go tool pprof", + "source": "# Analyze the profile in interactive mode.\n\ngo tool pprof http://localhost:8086/debug/pprof/allocs\n\n# `pprof` returns the following prompt:\n# Entering interactive mode (type \"help\" for commands, \"o\" for options)\n# (pprof)\n\n# At the prompt, get the top N memory allocations.\n\n(pprof) top10\n" } ], - "requestBody": { - "description": "The authorization to create.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthorizationPostRequest" - }, - "examples": { - "AuthorizationPostRequest": { - "$ref": "#/components/examples/AuthorizationPostRequest" - }, - "AuthorizationWithResourcePostRequest": { - "$ref": "#/components/examples/AuthorizationWithResourcePostRequest" - }, - "AuthorizationWithUserPostRequest": { - "$ref": "#/components/examples/AuthorizationWithUserPostRequest" - } - } + "servers": [ + { + "url": "" + } + ], + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "query", + "name": "debug", + "description": "- `0`: (Default) Return the report as a gzip-compressed protocol buffer.\n- `1`: Return a response body with the report formatted as human-readable text.\n The report contains comments that translate addresses to function names and line numbers for debugging.\n\n`debug=1` is mutually exclusive with the `seconds` query parameter.\n", + "schema": { + "type": "integer", + "format": "int64", + "enum": [ + 0, + 1 + ] + } + }, + { + "in": "query", + "name": "seconds", + "description": "Number of seconds to collect statistics.\n\n`seconds` is mutually exclusive with `debug=1`.\n", + "schema": { + "type": "string", + "format": "int64" } } - }, + ], "responses": { - "201": { - "description": "Success. The authorization is created. The response body contains the\nauthorization.\n", + "200": { + "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible\nwith [pprof](https://github.com/google/pprof) analysis and visualization tools.\nIf debug is enabled (`?debug=1`), response body contains a human-readable profile.\n", "content": { - "application/json": { + "application/octet-stream": { "schema": { - "$ref": "#/components/schemas/Authorization" + "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format.\n", + "type": "string", + "format": "binary", + "externalDocs": { + "description": "Golang pprof package", + "url": "https://pkg.go.dev/net/http/pprof" + } + } + }, + "text/plain": { + "schema": { + "description": "Response body contains a report formatted in plain text.\nThe report contains comments that translate addresses to\nfunction names and line numbers for debugging.\n", + "type": "string", + "format": "Go runtime profile", + "externalDocs": { + "description": "Golang pprof package", + "url": "https://pkg.go.dev/net/http/pprof" + } } } } }, - "400": { - "description": "Invalid request", - "$ref": "#/components/responses/GeneralServerError" - }, - "401": { - "$ref": "#/components/responses/AuthorizationError" - }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, "default": { "description": "Unexpected error", "$ref": "#/components/responses/GeneralServerError" @@ -11504,433 +11511,67 @@ } } }, - "/authorizations/{authID}": { + "/debug/pprof/block": { "get": { - "operationId": "GetAuthorizationsID", + "operationId": "GetDebugPprofBlock", "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" + "Debug", + "System information endpoints" + ], + "summary": "Retrieve the block runtime profile", + "description": "Collects samples and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof)\nreport of stack traces that led to blocking on synchronization primitives.\n", + "x-codeSamples": [ + { + "lang": "Shell", + "label": "Shell: go tool pprof", + "source": "# Analyze the profile in interactive mode.\n\ngo tool pprof http://localhost:8086/debug/pprof/block\n\n# `pprof` returns the following prompt:\n# Entering interactive mode (type \"help\" for commands, \"o\" for options)\n# (pprof)\n\n# At the prompt, get the top N entries.\n\n(pprof) top10\n" + } + ], + "servers": [ + { + "url": "" + } ], - "summary": "Retrieve an authorization", - "description": "Retrieves an authorization.\n\nUse this endpoint to retrieve information about an API token, including\nthe token's permissions and the user that the token is scoped to.\n\n#### InfluxDB OSS\n\n- InfluxDB OSS returns\n [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations.\n- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_,\n InfluxDB OSS returns authorizations for all organizations in the instance.\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", - "externalDocs": { - "url": "{{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/", - "description": "View tokens" - }, "parameters": [ { "$ref": "#/components/parameters/TraceSpan" }, { - "in": "path", - "name": "authID", + "in": "query", + "name": "debug", + "description": "- `0`: (Default) Return the report as a gzip-compressed protocol buffer.\n- `1`: Return a response body with the report formatted as human-readable text.\n The report contains comments that translate addresses to function names and line numbers for debugging.\n\n`debug=1` is mutually exclusive with the `seconds` query parameter.\n", "schema": { - "type": "string" - }, - "required": true, - "description": "An authorization ID. Specifies the authorization to retrieve." + "type": "integer", + "format": "int64", + "enum": [ + 0, + 1 + ] + } + }, + { + "in": "query", + "name": "seconds", + "description": "Number of seconds to collect statistics.\n\n`seconds` is mutually exclusive with `debug=1`.\n", + "schema": { + "type": "string", + "format": "int64" + } } ], "responses": { "200": { - "description": "Success. The response body contains the authorization.", + "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible\nwith [pprof](https://github.com/google/pprof) analysis and visualization tools.\nIf debug is enabled (`?debug=1`), response body contains a human-readable profile.\n", "content": { - "application/json": { + "application/octet-stream": { "schema": { - "$ref": "#/components/schemas/Authorization" - } - } - } - }, - "400": { - "description": "Bad request.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The specified resource ID is invalid.\n", - "value": { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/AuthorizationError" - }, - "404": { - "description": "Not found.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The requested authorization doesn't exist.\n", - "value": { - "code": "not found", - "message": "authorization not found" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - }, - "patch": { - "operationId": "PatchAuthorizationsID", - "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" - ], - "summary": "Update an API token to be active or inactive", - "description": "Updates an authorization.\n\nUse this endpoint to set an API token's status to be _active_ or _inactive_.\nInfluxDB rejects requests that use inactive API tokens.\n", - "requestBody": { - "description": "In the request body, provide the authorization properties to update.", - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AuthorizationUpdateRequest" - } - } - } - }, - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "path", - "name": "authID", - "schema": { - "type": "string" - }, - "required": true, - "description": "An authorization ID. Specifies the authorization to update." - } - ], - "responses": { - "200": { - "description": "Success. The response body contains the updated authorization.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Authorization" - } - } - } - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - }, - "delete": { - "operationId": "DeleteAuthorizationsID", - "tags": [ - "Authorizations (API tokens)", - "Security and access endpoints" - ], - "summary": "Delete an authorization", - "description": "Deletes an authorization.\n\nUse the endpoint to delete an API token.\n\nIf you want to disable an API token instead of delete it,\n[update the authorization's status to `inactive`](#operation/PatchAuthorizationsID).\n", - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "path", - "name": "authID", - "schema": { - "type": "string" - }, - "required": true, - "description": "An authorization ID. Specifies the authorization to delete." - } - ], - "responses": { - "204": { - "description": "Success. The authorization is deleted." - }, - "400": { - "description": "Bad request.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The specified resource ID is invalid.\n", - "value": { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - } - } - } - } - }, - "401": { - "$ref": "#/components/responses/AuthorizationError" - }, - "404": { - "description": "Not found.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "notFound": { - "summary": "The requested authorization doesn't exist.\n", - "value": { - "code": "not found", - "message": "authorization not found" - } - } - } - } - } - }, - "500": { - "$ref": "#/components/responses/InternalServerError" - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - } - }, - "/debug/pprof/all": { - "get": { - "operationId": "GetDebugPprofAllProfiles", - "tags": [ - "Debug", - "System information endpoints" - ], - "summary": "Retrieve all runtime profiles", - "description": "Collects samples and returns reports for the following [Go runtime profiles](https://pkg.go.dev/runtime/pprof):\n\n- **allocs**: All past memory allocations\n- **block**: Stack traces that led to blocking on synchronization primitives\n- **cpu**: (Optional) Program counters sampled from the executing stack.\n Include by passing the `cpu` query parameter with a [duration]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#duration) value.\n Equivalent to the report from [`GET /debug/pprof/profile?seconds=NUMBER_OF_SECONDS`](#operation/GetDebugPprofProfile).\n- **goroutine**: All current goroutines\n- **heap**: Memory allocations for live objects\n- **mutex**: Holders of contended mutexes\n- **threadcreate**: Stack traces that led to the creation of new OS threads\n", - "x-codeSamples": [ - { - "lang": "Shell", - "label": "Shell: Get all profiles", - "source": "# Download and extract a `tar.gz` of all profiles after 10 seconds of CPU sampling.\n\ncurl \"http://localhost:8086/debug/pprof/all?cpu=10s\" | tar -xz\n\n# x profiles/cpu.pb.gz\n# x profiles/goroutine.pb.gz\n# x profiles/block.pb.gz\n# x profiles/mutex.pb.gz\n# x profiles/heap.pb.gz\n# x profiles/allocs.pb.gz\n# x profiles/threadcreate.pb.gz\n\n# Analyze a profile.\n\ngo tool pprof profiles/heap.pb.gz\n" - }, - { - "lang": "Shell", - "label": "Shell: Get all profiles except CPU", - "source": "# Download and extract a `tar.gz` of all profiles except CPU.\n\ncurl http://localhost:8086/debug/pprof/all | tar -xz\n\n# x profiles/goroutine.pb.gz\n# x profiles/block.pb.gz\n# x profiles/mutex.pb.gz\n# x profiles/heap.pb.gz\n# x profiles/allocs.pb.gz\n# x profiles/threadcreate.pb.gz\n\n# Analyze a profile.\n\ngo tool pprof profiles/heap.pb.gz\n" - } - ], - "servers": [ - { - "url": "" - } - ], - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "query", - "name": "cpu", - "description": "Collects and returns CPU profiling data for the specified [duration]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#duration).\n", - "schema": { - "type": "string", - "format": "duration", - "externalDocs": { - "description": "InfluxDB duration", - "url": "https://docs.influxdata.com/influxdb/latest/reference/glossary/#duration" - } - } - } - ], - "responses": { - "200": { - "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) reports.\n", - "content": { - "application/octet-stream": { - "schema": { - "description": "GZIP compressed TAR file (`.tar.gz`) that contains\n[Go runtime profile](https://pkg.go.dev/runtime/pprof) reports.\n", - "type": "string", - "format": "binary", - "externalDocs": { - "description": "Golang pprof package", - "url": "https://pkg.go.dev/net/http/pprof" - } - } - } - } - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - } - }, - "/debug/pprof/allocs": { - "get": { - "operationId": "GetDebugPprofAllocs", - "tags": [ - "Debug", - "System information endpoints" - ], - "summary": "Retrieve the memory allocations runtime profile", - "description": "Returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of\nall past memory allocations.\n**allocs** is the same as the **heap** profile,\nbut changes the default [pprof](https://pkg.go.dev/runtime/pprof)\ndisplay to __-alloc_space__,\nthe total number of bytes allocated since the program began (including garbage-collected bytes).\n", - "x-codeSamples": [ - { - "lang": "Shell", - "label": "Shell: go tool pprof", - "source": "# Analyze the profile in interactive mode.\n\ngo tool pprof http://localhost:8086/debug/pprof/allocs\n\n# `pprof` returns the following prompt:\n# Entering interactive mode (type \"help\" for commands, \"o\" for options)\n# (pprof)\n\n# At the prompt, get the top N memory allocations.\n\n(pprof) top10\n" - } - ], - "servers": [ - { - "url": "" - } - ], - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "query", - "name": "debug", - "description": "- `0`: (Default) Return the report as a gzip-compressed protocol buffer.\n- `1`: Return a response body with the report formatted as human-readable text.\n The report contains comments that translate addresses to function names and line numbers for debugging.\n\n`debug=1` is mutually exclusive with the `seconds` query parameter.\n", - "schema": { - "type": "integer", - "format": "int64", - "enum": [ - 0, - 1 - ] - } - }, - { - "in": "query", - "name": "seconds", - "description": "Number of seconds to collect statistics.\n\n`seconds` is mutually exclusive with `debug=1`.\n", - "schema": { - "type": "string", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible\nwith [pprof](https://github.com/google/pprof) analysis and visualization tools.\nIf debug is enabled (`?debug=1`), response body contains a human-readable profile.\n", - "content": { - "application/octet-stream": { - "schema": { - "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format.\n", - "type": "string", - "format": "binary", - "externalDocs": { - "description": "Golang pprof package", - "url": "https://pkg.go.dev/net/http/pprof" - } - } - }, - "text/plain": { - "schema": { - "description": "Response body contains a report formatted in plain text.\nThe report contains comments that translate addresses to\nfunction names and line numbers for debugging.\n", - "type": "string", - "format": "Go runtime profile", - "externalDocs": { - "description": "Golang pprof package", - "url": "https://pkg.go.dev/net/http/pprof" - } - } - } - } - }, - "default": { - "description": "Unexpected error", - "$ref": "#/components/responses/GeneralServerError" - } - } - } - }, - "/debug/pprof/block": { - "get": { - "operationId": "GetDebugPprofBlock", - "tags": [ - "Debug", - "System information endpoints" - ], - "summary": "Retrieve the block runtime profile", - "description": "Collects samples and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof)\nreport of stack traces that led to blocking on synchronization primitives.\n", - "x-codeSamples": [ - { - "lang": "Shell", - "label": "Shell: go tool pprof", - "source": "# Analyze the profile in interactive mode.\n\ngo tool pprof http://localhost:8086/debug/pprof/block\n\n# `pprof` returns the following prompt:\n# Entering interactive mode (type \"help\" for commands, \"o\" for options)\n# (pprof)\n\n# At the prompt, get the top N entries.\n\n(pprof) top10\n" - } - ], - "servers": [ - { - "url": "" - } - ], - "parameters": [ - { - "$ref": "#/components/parameters/TraceSpan" - }, - { - "in": "query", - "name": "debug", - "description": "- `0`: (Default) Return the report as a gzip-compressed protocol buffer.\n- `1`: Return a response body with the report formatted as human-readable text.\n The report contains comments that translate addresses to function names and line numbers for debugging.\n\n`debug=1` is mutually exclusive with the `seconds` query parameter.\n", - "schema": { - "type": "integer", - "format": "int64", - "enum": [ - 0, - 1 - ] - } - }, - { - "in": "query", - "name": "seconds", - "description": "Number of seconds to collect statistics.\n\n`seconds` is mutually exclusive with `debug=1`.\n", - "schema": { - "type": "string", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible\nwith [pprof](https://github.com/google/pprof) analysis and visualization tools.\nIf debug is enabled (`?debug=1`), response body contains a human-readable profile.\n", - "content": { - "application/octet-stream": { - "schema": { - "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format.\n", - "type": "string", - "format": "binary", - "externalDocs": { - "description": "Golang pprof package", - "url": "https://pkg.go.dev/net/http/pprof" - } + "description": "[Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format.\n", + "type": "string", + "format": "binary", + "externalDocs": { + "description": "Golang pprof package", + "url": "https://pkg.go.dev/net/http/pprof" + } } }, "text/plain": { @@ -12979,6 +12620,259 @@ } } }, + "/authorizations": { + "get": { + "operationId": "GetAuthorizations", + "tags": [ + "Authorizations", + "Security and access endpoints" + ], + "summary": "List authorizations", + "description": "Lists authorizations.\n\nTo limit which authorizations are returned, pass query parameters in your request.\nIf no query parameters are passed, InfluxDB returns all authorizations.\n\n#### InfluxDB OSS\n\n- InfluxDB OSS returns\n [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations.\n- If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_,\n InfluxDB OSS returns authorizations for all organizations in the instance.\n\n#### Required permissions\n\n- An _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_.\n\n#### Related guides\n\n- [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/)\n", + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "query", + "name": "userID", + "schema": { + "type": "string" + }, + "description": "A user ID.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + }, + { + "in": "query", + "name": "user", + "schema": { + "type": "string" + }, + "description": "A user name.\nOnly returns authorizations scoped to the specified [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user).\n" + }, + { + "in": "query", + "name": "orgID", + "schema": { + "type": "string" + }, + "description": "An organization ID. Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization)." + }, + { + "in": "query", + "name": "org", + "schema": { + "type": "string" + }, + "description": "An organization name.\nOnly returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization).\n" + } + ], + "responses": { + "200": { + "description": "Success. The response body contains a list of authorizations.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Authorizations" + } + } + } + }, + "400": { + "description": "Invalid request", + "$ref": "#/components/responses/GeneralServerError" + }, + "401": { + "$ref": "#/components/responses/AuthorizationError" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + }, + "post": { + "operationId": "PostAuthorizations", + "tags": [ + "Authorizations" + ], + "summary": "Create an authorization", + "description": "Creates an authorization and returns the authorization with the\ngenerated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token).\n\nUse this endpoint to create an authorization, which generates an API token\nwith permissions to `read` or `write` to a specific resource or `type` of resource.\nThe response contains the new authorization with the generated API token.\n\n#### Limitations\n\nTo follow best practices for secure API token generation and retrieval,\nInfluxDB enforces access restrictions on API tokens.\n\n- In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any\n user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_.\n- You can't update an authorization's permissions.\n- Even if an API token has `read-authorizations` permission, the\n token can't be used to view its authorization details.\n- A token stops working when the user who created the authorization is deleted.\n\nWe recommend creating a generic user to create and manage tokens for writing data.\n\n#### Related guides\n\n- [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/)\n", + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + } + ], + "requestBody": { + "description": "The authorization to create.", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthorizationPostRequest" + }, + "examples": { + "AuthorizationPostRequest": { + "$ref": "#/components/examples/AuthorizationPostRequest" + }, + "AuthorizationWithResourcePostRequest": { + "$ref": "#/components/examples/AuthorizationWithResourcePostRequest" + }, + "AuthorizationWithUserPostRequest": { + "$ref": "#/components/examples/AuthorizationWithUserPostRequest" + } + } + } + } + }, + "responses": { + "201": { + "description": "Success. The authorization is created. The response body contains the authorization.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Authorization" + } + } + } + }, + "400": { + "description": "Invalid request", + "$ref": "#/components/responses/GeneralServerError" + }, + "401": { + "$ref": "#/components/responses/AuthorizationError" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + } + }, + "/authorizations/{authID}": { + "get": { + "operationId": "GetAuthorizationsID", + "tags": [ + "Authorizations", + "Security and access endpoints" + ], + "summary": "Retrieve an authorization", + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The ID of the authorization to get." + } + ], + "responses": { + "200": { + "description": "Authorization details", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Authorization" + } + } + } + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + }, + "patch": { + "operationId": "PatchAuthorizationsID", + "tags": [ + "Authorizations" + ], + "summary": "Update an authorization to be active or inactive", + "requestBody": { + "description": "Authorization to update", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthorizationUpdateRequest" + } + } + } + }, + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The ID of the authorization to update." + } + ], + "responses": { + "200": { + "description": "The active or inactive authorization", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Authorization" + } + } + } + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + }, + "delete": { + "operationId": "DeleteAuthorizationsID", + "tags": [ + "Authorizations" + ], + "summary": "Delete an authorization", + "parameters": [ + { + "$ref": "#/components/parameters/TraceSpan" + }, + { + "in": "path", + "name": "authID", + "schema": { + "type": "string" + }, + "required": true, + "description": "The ID of the authorization to delete." + } + ], + "responses": { + "204": { + "description": "Authorization deleted" + }, + "default": { + "description": "Unexpected error", + "$ref": "#/components/responses/GeneralServerError" + } + } + } + }, "/variables": { "get": { "operationId": "GetVariables", @@ -16931,7 +16825,7 @@ "AuthorizationUpdateRequest": { "properties": { "status": { - "description": "Status of the token. If `inactive`, InfluxDB rejects requests that use the token.", + "description": "Status of the token. If `inactive`, requests using the token will be rejected.", "default": "active", "type": "string", "enum": [ @@ -17164,7 +17058,7 @@ "shardGroupDurationSeconds": { "type": "integer", "format": "int64", - "description": "The shard group duration.\nThe duration or interval (in seconds) that each shard group covers.\n\n#### InfluxDB Cloud\n\n- Does not use `shardGroupDurationsSeconds`.\n\n#### InfluxDB OSS\n\n- Default value depends on the\n[bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration).\n" + "description": "The shard group duration.\nThe duration or interval (in seconds) that each shard group covers.\n\n#### InfluxDB Cloud\n\n- Does not use `shardGroupDurationsSeconds`.\n\n#### InfluxDB OSS\n\n- Default value depends on the\n[bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration).\n" } }, "required": [ @@ -24850,7 +24744,7 @@ "type": "apiKey", "name": "Authorization", "in": "header", - "description": "Use the [Token authentication](#section/Authentication/TokenAuthentication)\nscheme to authenticate to the InfluxDB API.\n\nIn your API requests, send an `Authorization` header.\nFor the header value, provide the word `Token` followed by a space and an InfluxDB API token.\nThe word `Token` is case-sensitive.\n\n### Syntax\n\n`Authorization: Token INFLUX_API_TOKEN`\n\n### Example\n\n#### Use Token authentication with cURL\n\nThe following example shows how to use cURL to send an API request that uses Token authentication:\n\n```sh\ncurl --request GET \"INFLUX_URL/api/v2/buckets\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n```\n\nReplace the following:\n\n - *`INFLUX_URL`*: your InfluxDB URL\n - *`INFLUX_API_TOKEN`*: your [InfluxDB API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n\n### Related endpoints\n\n- [`/authorizations` endpoints](#tag/Authorizations-(API-tokens))\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n" + "description": "Use the [Token authentication](#section/Authentication/TokenAuthentication)\nscheme to authenticate to the InfluxDB API.\n\nIn your API requests, send an `Authorization` header.\nFor the header value, provide the word `Token` followed by a space and an InfluxDB API token.\nThe word `Token` is case-sensitive.\n\n### Syntax\n\n`Authorization: Token INFLUX_API_TOKEN`\n\n### Example\n\n#### Use Token authentication with cURL\n\nThe following example shows how to use cURL to send an API request that uses Token authentication:\n\n```sh\ncurl --request GET \"INFLUX_URL/api/v2/buckets\" \\\n --header \"Authorization: Token INFLUX_API_TOKEN\"\n```\n\nReplace the following:\n\n - *`INFLUX_URL`*: your InfluxDB URL\n - *`INFLUX_API_TOKEN`*: your [InfluxDB API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token)\n\n### Related endpoints\n\n- [`/authorizations` endpoints](#tag/Authorizations)\n\n### Related guides\n\n- [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication)\n- [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/)\n" }, "BasicAuthentication": { "type": "http", diff --git a/contracts/oss.yml b/contracts/oss.yml index 0dae355a6..9246054dd 100644 --- a/contracts/oss.yml +++ b/contracts/oss.yml @@ -10,7 +10,7 @@ info: servers: - url: /api/v2 tags: - - name: Authorizations (API tokens) + - name: Authorizations description: | Create and manage authorizations (API tokens). @@ -18,9 +18,23 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + + API tokens are visible to the user who created the authorization and to any + user with an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + In InfluxDB OSS, even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + We recommend creating a generic user to create and manage tokens for writing data. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If a user signs in with username and password, creating a _user session_, @@ -104,7 +118,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -112,7 +126,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/latest/process-data/get-started/) - [Common data processing tasks](https://docs.influxdata.com/influxdb/latest/process-data/common-tasks/) @@ -136,7 +150,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks](https://docs.influxdata.com/influxdb/latest/influxdb-templates/stacks/) - [InfluxDB templates](https://docs.influxdata.com/influxdb/latest/influxdb-templates/) @@ -147,14 +161,14 @@ tags: To grant a user permission to access data, add them as a member of an organization and provide them with an API token. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/latest/influxdb/latest/users/) - [Create a token scoped to a user](https://docs.influxdata.com/influxdb/latest/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user) @@ -221,7 +235,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records, @@ -5336,7 +5350,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5352,7 +5366,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5417,7 +5431,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5432,7 +5446,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -5518,7 +5532,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -5534,7 +5548,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -6012,7 +6026,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6109,7 +6123,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6209,7 +6223,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6270,7 +6284,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6331,7 +6345,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -6341,7 +6355,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -6416,7 +6430,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -6431,7 +6445,7 @@ paths: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -7779,7 +7793,7 @@ paths: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -7788,7 +7802,7 @@ paths: #### Related guides - - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/reference/config-options/) + - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/) parameters: - $ref: '#/components/parameters/TraceSpan' responses: @@ -7951,7 +7965,7 @@ paths: summary: Add a member to a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. parameters: @@ -8024,7 +8038,7 @@ paths: summary: List all owners of a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. parameters: @@ -8076,7 +8090,7 @@ paths: summary: Add an owner for a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. @@ -8149,7 +8163,7 @@ paths: summary: Remove an owner from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -9261,352 +9275,6 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /authorizations: - get: - operationId: GetAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: List authorizations - description: | - Lists authorizations. - - To limit which authorizations are returned, pass query parameters in your request. - If no query parameters are passed, InfluxDB returns all authorizations. - - #### InfluxDB Cloud - - - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) - values in `GET /api/v2/authorizations` responses; - returns `token: redacted` for all authorizations. - - #### Required permissions - - To retrieve an authorization, the request must use an API token that has the - following permissions: - - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: query - name: userID - schema: - type: string - description: | - A user ID. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). - - in: query - name: user - schema: - type: string - description: | - A user name. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). - - in: query - name: orgID - schema: - type: string - description: 'An organization ID. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization).' - - in: query - name: org - schema: - type: string - description: | - An organization name. - Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). - - in: query - name: token - schema: - type: string - description: | - An API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. - responses: - '200': - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorizations' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - post: - operationId: PostAuthorizations - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Create an authorization - description: | - Creates an authorization and returns the authorization with the - generated API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token). - - Use this endpoint to create an authorization, which generates an API token - with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. - - To follow best practices for secure API token generation and retrieval, - InfluxDB enforces access restrictions on API tokens. - - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. - - We recommend the following for managing your tokens: - - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions - - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to - - #### Related guides - - - [Create a token](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/) - parameters: - - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: The authorization to create. - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationPostRequest' - examples: - AuthorizationPostRequest: - $ref: '#/components/examples/AuthorizationPostRequest' - AuthorizationWithResourcePostRequest: - $ref: '#/components/examples/AuthorizationWithResourcePostRequest' - AuthorizationWithUserPostRequest: - $ref: '#/components/examples/AuthorizationWithUserPostRequest' - responses: - '201': - description: | - Success. The authorization is created. The response body contains the - authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: Invalid request - $ref: '#/components/responses/GeneralServerError' - '401': - $ref: '#/components/responses/AuthorizationError' - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - '/authorizations/{authID}': - get: - operationId: GetAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Retrieve an authorization - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) - externalDocs: - url: 'https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/' - description: View tokens - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to retrieve. - responses: - '200': - description: Success. The response body contains the authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - patch: - operationId: PatchAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Update an API token to be active or inactive - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. - requestBody: - description: 'In the request body, provide the authorization properties to update.' - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/AuthorizationUpdateRequest' - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to update. - responses: - '200': - description: Success. The response body contains the updated authorization. - content: - application/json: - schema: - $ref: '#/components/schemas/Authorization' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' - delete: - operationId: DeleteAuthorizationsID - tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Delete an authorization - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: An authorization ID. Specifies the authorization to delete. - responses: - '204': - description: Success. The authorization is deleted. - '400': - description: | - Bad request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - '401': - $ref: '#/components/responses/AuthorizationError' - '404': - description: | - Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - '500': - $ref: '#/components/responses/InternalServerError' - default: - description: Unexpected error - $ref: '#/components/responses/GeneralServerError' /debug/pprof/all: get: operationId: GetDebugPprofAllProfiles @@ -10821,6 +10489,216 @@ paths: default: description: Unexpected error $ref: '#/components/responses/GeneralServerError' + /authorizations: + get: + operationId: GetAuthorizations + tags: + - Authorizations + - Security and access endpoints + summary: List authorizations + description: | + Lists authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations. + + #### InfluxDB OSS + + - InfluxDB OSS returns + [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in authorizations. + - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. + + #### Required permissions + + - An _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + + #### Related guides + + - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: query + name: userID + schema: + type: string + description: | + A user ID. + Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). + - in: query + name: user + schema: + type: string + description: | + A user name. + Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/latest/reference/glossary/#user). + - in: query + name: orgID + schema: + type: string + description: 'An organization ID. Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization).' + - in: query + name: org + schema: + type: string + description: | + An organization name. + Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/latest/reference/glossary/#organization). + responses: + '200': + description: Success. The response body contains a list of authorizations. + content: + application/json: + schema: + $ref: '#/components/schemas/Authorizations' + '400': + description: Invalid request + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + post: + operationId: PostAuthorizations + tags: + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the authorization with the + generated API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token). + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + The response contains the new authorization with the generated API token. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + - You can't update an authorization's permissions. + - Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + - A token stops working when the user who created the authorization is deleted. + + We recommend creating a generic user to create and manage tokens for writing data. + + #### Related guides + + - [Create a token](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/) + parameters: + - $ref: '#/components/parameters/TraceSpan' + requestBody: + description: The authorization to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationPostRequest' + examples: + AuthorizationPostRequest: + $ref: '#/components/examples/AuthorizationPostRequest' + AuthorizationWithResourcePostRequest: + $ref: '#/components/examples/AuthorizationWithResourcePostRequest' + AuthorizationWithUserPostRequest: + $ref: '#/components/examples/AuthorizationWithUserPostRequest' + responses: + '201': + description: | + Success. The authorization is created. The response body contains the authorization. + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + '400': + description: Invalid request + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + '/authorizations/{authID}': + get: + operationId: GetAuthorizationsID + tags: + - Authorizations + - Security and access endpoints + summary: Retrieve an authorization + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to get. + responses: + '200': + description: Authorization details + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + patch: + operationId: PatchAuthorizationsID + tags: + - Authorizations + summary: Update an authorization to be active or inactive + requestBody: + description: Authorization to update + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/AuthorizationUpdateRequest' + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to update. + responses: + '200': + description: The active or inactive authorization + content: + application/json: + schema: + $ref: '#/components/schemas/Authorization' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + delete: + operationId: DeleteAuthorizationsID + tags: + - Authorizations + summary: Delete an authorization + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: authID + schema: + type: string + required: true + description: The ID of the authorization to delete. + responses: + '204': + description: Authorization deleted + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' /variables: get: operationId: GetVariables @@ -13536,7 +13414,7 @@ components: AuthorizationUpdateRequest: properties: status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' default: active type: string enum: @@ -13777,7 +13655,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period](https://docs.influxdata.com/influxdb/latest/reference/internals/shards/#shard-group-duration). + [bucket retention period](https://docs.influxdata.com/influxdb/latest/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds Link: @@ -19264,7 +19142,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/contracts/priv/cloud-priv.yml b/contracts/priv/cloud-priv.yml index a54c7055a..75280b1ff 100644 --- a/contracts/priv/cloud-priv.yml +++ b/contracts/priv/cloud-priv.yml @@ -853,7 +853,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). + [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration). required: - everySeconds labels: @@ -889,7 +889,7 @@ components: allOf: - properties: status: - description: 'Status of the token. If `inactive`, InfluxDB rejects requests that use the token.' + description: 'Status of the token. If `inactive`, requests using the token will be rejected.' default: active type: string enum: diff --git a/contracts/ref/cloud.yml b/contracts/ref/cloud.yml index 40abc74fd..1ead54ff5 100644 --- a/contracts/ref/cloud.yml +++ b/contracts/ref/cloud.yml @@ -387,8 +387,8 @@ components: type: string status: default: active - description: Status of the token. If `inactive`, InfluxDB rejects requests - that use the token. + description: Status of the token. If `inactive`, requests using the token + will be rejected. enum: - active - inactive @@ -2407,23 +2407,22 @@ components: - $ref: '#/components/schemas/AuthorizationUpdateRequest' - properties: orgID: - description: The organization ID. Identifies the organization that the - authorization is scoped to. + description: The ID of the organization that the authorization is scoped + to. type: string permissions: description: | - The list of permissions that provide `read` and `write` access to organization resources. + A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. items: $ref: '#/components/schemas/Permission' minItems: 1 type: array token: - description: The name that you provide for the authorization. + description: A name that you provide for the authorization. type: string userID: - description: The user ID. Identifies the user that the authorization is - scoped to. + description: The ID of the user that the authorization is scoped to. type: string type: object required: @@ -4045,7 +4044,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period](https://docs.influxdata.com/influxdb/cloud/reference/internals/shards/#shard-group-duration). + [bucket retention period](https://docs.influxdata.com/influxdb/cloud/v2.3/reference/internals/shards/#shard-group-duration). format: int64 type: integer type: @@ -6770,7 +6769,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides @@ -6816,7 +6815,7 @@ paths: Lists authorizations. To limit which authorizations are returned, pass query parameters in your request. - If no query parameters are passed, InfluxDB returns all authorizations. + If no query parameters are passed, InfluxDB returns all authorizations for the organization. #### InfluxDB Cloud @@ -6826,11 +6825,7 @@ paths: #### Required permissions - To retrieve an authorization, the request must use an API token that has the - following permissions: - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to #### Related guides @@ -6840,46 +6835,39 @@ paths: - $ref: '#/components/parameters/TraceSpan' - description: | A user ID. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + Only returns authorizations scoped to the specified + [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). in: query name: userID schema: type: string - description: | A user name. - Only returns authorizations scoped to the specified [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). + Only returns authorizations scoped to the specified + [user](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#user). in: query name: user schema: type: string - - description: An organization ID. Only returns authorizations that belong to - the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + - description: | + An organization ID. + Only returns authorizations that belong to the specified + [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). in: query name: orgID schema: type: string - description: | An organization name. - Only returns authorizations that belong to the specified [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). + Only returns authorizations that belong to the specified + [organization](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#organization). in: query name: org schema: type: string - description: | An API [token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. + Returns the authorization for the specified token. in: query name: token schema: @@ -6890,19 +6878,7 @@ paths: application/json: schema: $ref: '#/components/schemas/Authorizations' - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. + description: Success. The response body contains a list of authorizations. "400": $ref: '#/components/responses/GeneralServerError' description: Invalid request @@ -6915,8 +6891,7 @@ paths: description: Unexpected error summary: List authorizations tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations post: description: | Creates an authorization and returns the authorization with the @@ -6924,24 +6899,20 @@ paths: Use this endpoint to create an authorization, which generates an API token with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. + + #### Limitations To follow best practices for secure API token generation and retrieval, - InfluxDB enforces access restrictions on API tokens. + InfluxDB Cloud enforces access restrictions on API tokens. - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. + - InfluxDB only allows access to the API token value immediately after the authorization is created. + - You can't update an authorization's permissions. + - A token stops working when the user who created the authorization is deleted. We recommend the following for managing your tokens: - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions - - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. #### Related guides @@ -6970,8 +6941,7 @@ paths: schema: $ref: '#/components/schemas/Authorization' description: | - Success. The authorization is created. The response body contains the - authorization. + Success. The authorization is created. The response body contains the authorization. "400": $ref: '#/components/responses/GeneralServerError' description: Invalid request @@ -6984,21 +6954,13 @@ paths: description: Unexpected error summary: Create an authorization tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations /api/v2/authorizations/{authID}: delete: - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). operationId: DeleteAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to delete. + - description: The identifier of the authorization to delete. in: path name: authID required: true @@ -7006,70 +6968,18 @@ paths: type: string responses: "204": - description: Success. The authorization is deleted. - "400": - content: - application/json: - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - schema: - $ref: '#/components/schemas/Error' - description: | - Bad request. - "401": - $ref: '#/components/responses/AuthorizationError' - "404": - content: - application/json: - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - schema: - $ref: '#/components/schemas/Error' - description: | - Not found. - "500": - $ref: '#/components/responses/InternalServerError' + description: Authorization deleted default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Delete an authorization tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations get: - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/) - externalDocs: - description: View tokens - url: https://docs.influxdata.com/influxdb/cloud/security/tokens/view-tokens/ operationId: GetAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to retrieve. + - description: The identifier of the authorization to get. in: path name: authID required: true @@ -7081,56 +6991,19 @@ paths: application/json: schema: $ref: '#/components/schemas/Authorization' - description: Success. The response body contains the authorization. - "400": - content: - application/json: - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - schema: - $ref: '#/components/schemas/Error' - description: | - Bad request. - "401": - $ref: '#/components/responses/AuthorizationError' - "404": - content: - application/json: - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - schema: - $ref: '#/components/schemas/Error' - description: | - Not found. - "500": - $ref: '#/components/responses/InternalServerError' + description: Authorization details default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Retrieve an authorization tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations patch: - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. + description: Update an authorization's status to `active` or `inactive`. operationId: PatchAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to update. + - description: The identifier of the authorization to update. in: path name: authID required: true @@ -7141,8 +7014,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AuthorizationUpdateRequest' - description: In the request body, provide the authorization properties to - update. + description: The updated Authorization object. required: true responses: "200": @@ -7150,14 +7022,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Authorization' - description: Success. The response body contains the updated authorization. + description: The updated authorization. default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error - summary: Update an API token to be active or inactive + summary: Update authorization status tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations /api/v2/buckets: get: description: | @@ -8161,7 +8032,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8177,7 +8048,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -8242,7 +8113,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8257,7 +8128,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -8343,7 +8214,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8359,7 +8230,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -10507,7 +10378,7 @@ paths: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/cloud/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/cloud/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -10516,7 +10387,7 @@ paths: #### Related guides - - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/cloud/reference/config-options/) + - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/cloud/influxdb/v2.4/reference/config-options/) operationId: GetFlags parameters: - $ref: '#/components/parameters/TraceSpan' @@ -11818,7 +11689,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -11916,7 +11787,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12015,7 +11886,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12076,7 +11947,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -12138,7 +12009,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -12148,7 +12019,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) operationId: PostOrgsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' @@ -12222,7 +12093,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12237,7 +12108,7 @@ paths: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) operationId: DeleteOrgsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' @@ -16015,7 +15886,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. operationId: PostTasksIDMembers @@ -16088,7 +15959,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. operationId: GetTasksIDOwners @@ -16140,7 +16011,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. @@ -16213,7 +16084,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: DeleteTasksIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' @@ -18976,12 +18847,24 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + In InfluxDB Cloud, an authorization with `read-authorizations` permission + can be used to view other authorizations. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + We recommend the following for managing your tokens: - Create a generic user to create and manage tokens for writing data. - Store your tokens in a secure password vault for future access. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If the user signs in with username and password, creating a _user session_, @@ -18999,7 +18882,7 @@ tags: - [Authorize API requests](https://docs.influxdata.com/influxdb/cloud/api-guide/api_intro/#authentication) - [Manage API tokens](https://docs.influxdata.com/influxdb/cloud/security/tokens/) - [Assign a token to a specific user](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/) - name: Authorizations (API tokens) + name: Authorizations - description: | Store your data in InfluxDB [buckets](https://docs.influxdata.com/influxdb/cloud/reference/glossary/#bucket). A bucket is a named location where time series data is stored. All buckets @@ -19043,7 +18926,7 @@ tags: Use the `/api/v2/scripts` endpoints to create and manage scripts. See related guides to learn how to define parameters and execute scripts. - ### Related guides + #### Related guides - [Invoke custom scripts](https://docs.influxdata.com/influxdb/cloud/api-guide/api-invokable-scripts/) from API requests. - [Create a task that references a script](https://docs.influxdata.com/influxdb/cloud/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) @@ -19072,7 +18955,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -19080,7 +18963,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/cloud/process-data/get-started/) - [Common data processing tasks](https://docs.influxdata.com/influxdb/cloud/process-data/common-tasks/) @@ -19103,7 +18986,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks](https://docs.influxdata.com/influxdb/cloud/influxdb-templates/stacks/) - [InfluxDB templates](https://docs.influxdata.com/influxdb/cloud/influxdb-templates/) @@ -19118,14 +19001,14 @@ tags: `GET /api/v2/users` and `GET /api/v2/users/USER_ID` API endpoints to view specific members. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/cloud/organizations/users/) name: Users @@ -19200,7 +19083,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records, diff --git a/contracts/ref/oss.yml b/contracts/ref/oss.yml index 83cff1b74..60a92ce9f 100644 --- a/contracts/ref/oss.yml +++ b/contracts/ref/oss.yml @@ -372,8 +372,8 @@ components: type: string status: default: active - description: Status of the token. If `inactive`, InfluxDB rejects requests - that use the token. + description: Status of the token. If `inactive`, requests using the token + will be rejected. enum: - active - inactive @@ -2426,23 +2426,22 @@ components: - $ref: '#/components/schemas/AuthorizationUpdateRequest' - properties: orgID: - description: The organization ID. Identifies the organization that the - authorization is scoped to. + description: The ID of the organization that the authorization is scoped + to. type: string permissions: description: | - The list of permissions that provide `read` and `write` access to organization resources. + A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. items: $ref: '#/components/schemas/Permission' minItems: 1 type: array token: - description: The name that you provide for the authorization. + description: A name that you provide for the authorization. type: string userID: - description: The user ID. Identifies the user that the authorization is - scoped to. + description: The ID of the user that the authorization is scoped to. type: string type: object required: @@ -4018,7 +4017,7 @@ components: #### InfluxDB OSS - Default value depends on the - [bucket retention period](https://docs.influxdata.com/influxdb/latest/reference/internals/shards/#shard-group-duration). + [bucket retention period](https://docs.influxdata.com/influxdb/latest/v2.3/reference/internals/shards/#shard-group-duration). format: int64 type: integer type: @@ -6788,7 +6787,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides @@ -6836,19 +6835,16 @@ paths: To limit which authorizations are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all authorizations. - #### InfluxDB Cloud + #### InfluxDB OSS - - InfluxDB Cloud doesn't expose [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) - values in `GET /api/v2/authorizations` responses; - returns `token: redacted` for all authorizations. + - InfluxDB OSS returns + [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in authorizations. + - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. #### Required permissions - To retrieve an authorization, the request must use an API token that has the - following permissions: - - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to + - An _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. #### Related guides @@ -6883,44 +6879,13 @@ paths: name: org schema: type: string - - description: | - An API [token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. - in: query - name: token - schema: - type: string responses: "200": content: application/json: schema: $ref: '#/components/schemas/Authorizations' - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. + description: Success. The response body contains a list of authorizations. "400": $ref: '#/components/responses/GeneralServerError' description: Invalid request @@ -6933,7 +6898,7 @@ paths: description: Unexpected error summary: List authorizations tags: - - Authorizations (API tokens) + - Authorizations - Security and access endpoints post: description: | @@ -6942,24 +6907,21 @@ paths: Use this endpoint to create an authorization, which generates an API token with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. + The response contains the new authorization with the generated API token. + + #### Limitations To follow best practices for secure API token generation and retrieval, InfluxDB enforces access restrictions on API tokens. - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. - - We recommend the following for managing your tokens: + - In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + - You can't update an authorization's permissions. + - Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + - A token stops working when the user who created the authorization is deleted. - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions - - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to + We recommend creating a generic user to create and manage tokens for writing data. #### Related guides @@ -6988,8 +6950,7 @@ paths: schema: $ref: '#/components/schemas/Authorization' description: | - Success. The authorization is created. The response body contains the - authorization. + Success. The authorization is created. The response body contains the authorization. "400": $ref: '#/components/responses/GeneralServerError' description: Invalid request @@ -7002,21 +6963,13 @@ paths: description: Unexpected error summary: Create an authorization tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations /api/v2/authorizations/{authID}: delete: - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). operationId: DeleteAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to delete. + - description: The ID of the authorization to delete. in: path name: authID required: true @@ -7024,70 +6977,18 @@ paths: type: string responses: "204": - description: Success. The authorization is deleted. - "400": - content: - application/json: - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - schema: - $ref: '#/components/schemas/Error' - description: | - Bad request. - "401": - $ref: '#/components/responses/AuthorizationError' - "404": - content: - application/json: - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - schema: - $ref: '#/components/schemas/Error' - description: | - Not found. - "500": - $ref: '#/components/responses/InternalServerError' + description: Authorization deleted default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Delete an authorization tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations get: - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token](https://docs.influxdata.com/influxdb/latest/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/) - externalDocs: - description: View tokens - url: https://docs.influxdata.com/influxdb/latest/security/tokens/view-tokens/ operationId: GetAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to retrieve. + - description: The ID of the authorization to get. in: path name: authID required: true @@ -7099,56 +7000,19 @@ paths: application/json: schema: $ref: '#/components/schemas/Authorization' - description: Success. The response body contains the authorization. - "400": - content: - application/json: - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: - code: invalid - message: id must have a length of 16 bytes - schema: - $ref: '#/components/schemas/Error' - description: | - Bad request. - "401": - $ref: '#/components/responses/AuthorizationError' - "404": - content: - application/json: - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: - code: not found - message: authorization not found - schema: - $ref: '#/components/schemas/Error' - description: | - Not found. - "500": - $ref: '#/components/responses/InternalServerError' + description: Authorization details default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error summary: Retrieve an authorization tags: - - Authorizations (API tokens) + - Authorizations - Security and access endpoints patch: - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. operationId: PatchAuthorizationsID parameters: - $ref: '#/components/parameters/TraceSpan' - - description: An authorization ID. Specifies the authorization to update. + - description: The ID of the authorization to update. in: path name: authID required: true @@ -7159,8 +7023,7 @@ paths: application/json: schema: $ref: '#/components/schemas/AuthorizationUpdateRequest' - description: In the request body, provide the authorization properties to - update. + description: Authorization to update required: true responses: "200": @@ -7168,14 +7031,13 @@ paths: application/json: schema: $ref: '#/components/schemas/Authorization' - description: Success. The response body contains the updated authorization. + description: The active or inactive authorization default: $ref: '#/components/responses/GeneralServerError' description: Unexpected error - summary: Update an API token to be active or inactive + summary: Update an authorization to be active or inactive tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations /api/v2/backup/kv: get: deprecated: true @@ -8313,7 +8175,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8329,7 +8191,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -8394,7 +8256,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8409,7 +8271,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -8495,7 +8357,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -8511,7 +8373,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -11026,7 +10888,7 @@ paths: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -11035,7 +10897,7 @@ paths: #### Related guides - - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/reference/config-options/) + - [InfluxDB configuration options](https://docs.influxdata.com/influxdb/latest/influxdb/v2.4/reference/config-options/) operationId: GetFlags parameters: - $ref: '#/components/parameters/TraceSpan' @@ -12392,7 +12254,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12490,7 +12352,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12589,7 +12451,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12650,7 +12512,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -12712,7 +12574,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -12722,7 +12584,7 @@ paths: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) operationId: PostOrgsIDOwners parameters: - $ref: '#/components/parameters/TraceSpan' @@ -12796,7 +12658,7 @@ paths: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -12811,7 +12673,7 @@ paths: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) operationId: DeleteOrgsIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' @@ -16897,7 +16759,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. operationId: PostTasksIDMembers @@ -16970,7 +16832,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. operationId: GetTasksIDOwners @@ -17022,7 +16884,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. @@ -17095,7 +16957,7 @@ paths: deprecated: true description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. operationId: DeleteTasksIDOwnersID parameters: - $ref: '#/components/parameters/TraceSpan' @@ -19892,9 +19754,23 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + + API tokens are visible to the user who created the authorization and to any + user with an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. + In InfluxDB OSS, even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + We recommend creating a generic user to create and manage tokens for writing data. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If a user signs in with username and password, creating a _user session_, @@ -19912,7 +19788,7 @@ tags: - [Authorize API requests](https://docs.influxdata.com/influxdb/latest/api-guide/api_intro/#authentication) - [Manage API tokens](https://docs.influxdata.com/influxdb/latest/security/tokens/) - [Assign a token to a specific user](https://docs.influxdata.com/influxdb/latest/security/tokens/create-token/) - name: Authorizations (API tokens) + name: Authorizations - description: | Store your data in InfluxDB [buckets](https://docs.influxdata.com/influxdb/latest/reference/glossary/#bucket). A bucket is a named location where time series data is stored. All buckets @@ -19978,7 +19854,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -19986,7 +19862,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks](https://docs.influxdata.com/influxdb/latest/process-data/get-started/) - [Common data processing tasks](https://docs.influxdata.com/influxdb/latest/process-data/common-tasks/) @@ -20010,7 +19886,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks](https://docs.influxdata.com/influxdb/latest/influxdb-templates/stacks/) - [InfluxDB templates](https://docs.influxdata.com/influxdb/latest/influxdb-templates/) @@ -20021,14 +19897,14 @@ tags: To grant a user permission to access data, add them as a member of an organization and provide them with an API token. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users](https://docs.influxdata.com/influxdb/latest/influxdb/latest/users/) - [Create a token scoped to a user](https://docs.influxdata.com/influxdb/latest/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user) @@ -20104,7 +19980,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records, diff --git a/src/cloud.yml b/src/cloud.yml index 080c39d7f..61ed7d1d9 100644 --- a/src/cloud.yml +++ b/src/cloud.yml @@ -21,6 +21,10 @@ paths: $ref: './cloud/paths/setup.yml' /setup/user: $ref: './cloud/paths/setup_user.yml' + /authorizations: + $ref: './cloud/paths/authorizations.yml' + /authorizations/{authID}: + $ref: './cloud/paths/authorizations_authID.yml' /variables: $ref: './cloud/paths/variables.yml' '/variables/{variableID}': @@ -128,7 +132,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/src/cloud/paths/authorizations.yml b/src/cloud/paths/authorizations.yml new file mode 100644 index 000000000..eb20d6ac9 --- /dev/null +++ b/src/cloud/paths/authorizations.yml @@ -0,0 +1,145 @@ +get: + operationId: GetAuthorizations + tags: + - Authorizations + summary: List authorizations + description: | + Lists authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations for the organization. + + #### InfluxDB Cloud + + - InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) + values in `GET /api/v2/authorizations` responses; + returns `token: redacted` for all authorizations. + + #### Required permissions + + - `read-authorizations` + + #### Related guides + + - [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) + parameters: + - $ref: "../../common/parameters/TraceSpan.yml" + - in: query + name: userID + schema: + type: string + description: | + A user ID. + Only returns authorizations scoped to the specified + [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: user + schema: + type: string + description: | + A user name. + Only returns authorizations scoped to the specified + [user]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#user). + - in: query + name: orgID + schema: + type: string + description: | + An organization ID. + Only returns authorizations that belong to the specified + [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + - in: query + name: org + schema: + type: string + description: | + An organization name. + Only returns authorizations that belong to the specified + [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). + - in: query + name: token + schema: + type: string + description: | + An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value. + Returns the authorization for the specified token. + responses: + "200": + description: Success. The response body contains a list of authorizations. + content: + application/json: + schema: + $ref: "../../common/schemas/Authorizations.yml" + "400": + description: Invalid request + $ref: '../../common/responses/ServerError.yml' + "401": + $ref: "../../common/responses/AuthorizationError.yml" + "500": + $ref: "../../common/responses/InternalServerError.yml" + default: + description: Unexpected error + $ref: '../../common/responses/ServerError.yml' +post: + operationId: PostAuthorizations + tags: + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the authorization with the + generated API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token). + + Use this endpoint to create an authorization, which generates an API token + with permissions to `read` or `write` to a specific resource or `type` of resource. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB Cloud enforces access restrictions on API tokens. + + - InfluxDB only allows access to the API token value immediately after the authorization is created. + - You can't update an authorization's permissions. + - A token stops working when the user who created the authorization is deleted. + + We recommend the following for managing your tokens: + + - Create a generic user to create and manage tokens for writing data. + - Store your tokens in a secure password vault for future access. + + #### Related guides + + - [Create a token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/create-token/) + parameters: + - $ref: "../../common/parameters/TraceSpan.yml" + requestBody: + description: The authorization to create. + required: true + content: + application/json: + schema: + $ref: "../../common/schemas/AuthorizationPostRequest.yml" + examples: + AuthorizationPostRequest: + $ref: "../../common/requestBody/examples/AuthorizationRequestExamples.yml#/AuthorizationPostRequest" + AuthorizationWithResourcePostRequest: + $ref: "../../common/requestBody/examples/AuthorizationRequestExamples.yml#/AuthorizationWithResourcePostRequest" + AuthorizationWithUserPostRequest: + $ref: "../../common/requestBody/examples/AuthorizationRequestExamples.yml#/AuthorizationWithUserPostRequest" + responses: + "201": + description: | + Success. The authorization is created. The response body contains the authorization. + content: + application/json: + schema: + $ref: "../../common/schemas/Authorization.yml" + "400": + description: Invalid request + $ref: '../../common/responses/ServerError.yml' + "401": + $ref: "../../common/responses/AuthorizationError.yml" + "500": + $ref: "../../common/responses/InternalServerError.yml" + default: + description: Unexpected error + $ref: '../../common/responses/ServerError.yml' diff --git a/src/cloud/paths/authorizations_authID.yml b/src/cloud/paths/authorizations_authID.yml new file mode 100644 index 000000000..c85317bfb --- /dev/null +++ b/src/cloud/paths/authorizations_authID.yml @@ -0,0 +1,73 @@ +get: + operationId: GetAuthorizationsID + tags: + - Authorizations + summary: Retrieve an authorization + parameters: + - $ref: "../../common/parameters/TraceSpan.yml" + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to get. + responses: + "200": + description: Authorization details + content: + application/json: + schema: + $ref: "../../common/schemas/Authorization.yml" + default: + description: Unexpected error + $ref: '../../common/responses/ServerError.yml' +patch: + operationId: PatchAuthorizationsID + tags: + - Authorizations + summary: Update authorization status + description: Update an authorization's status to `active` or `inactive`. + requestBody: + description: The updated Authorization object. + required: true + content: + application/json: + schema: + $ref: "../../common/schemas/AuthorizationUpdateRequest.yml" + parameters: + - $ref: "../../common/parameters/TraceSpan.yml" + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to update. + responses: + "200": + description: The updated authorization. + content: + application/json: + schema: + $ref: "../../common/schemas/Authorization.yml" + default: + description: Unexpected error + $ref: '../../common/responses/ServerError.yml' +delete: + operationId: DeleteAuthorizationsID + tags: + - Authorizations + summary: Delete an authorization + parameters: + - $ref: "../../common/parameters/TraceSpan.yml" + - in: path + name: authID + schema: + type: string + required: true + description: The identifier of the authorization to delete. + responses: + "204": + description: Authorization deleted + default: + description: Unexpected error + $ref: '../../common/responses/ServerError.yml' diff --git a/src/cloud/tags.yml b/src/cloud/tags.yml index 44ac6d00b..863354638 100644 --- a/src/cloud/tags.yml +++ b/src/cloud/tags.yml @@ -1,5 +1,5 @@ tags: - - name: Authorizations (API tokens) + - name: Authorizations description: | Create and manage authorizations (API tokens). @@ -7,12 +7,24 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + In InfluxDB Cloud, an authorization with `read-authorizations` permission + can be used to view other authorizations. + + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + We recommend the following for managing your tokens: - Create a generic user to create and manage tokens for writing data. - Store your tokens in a secure password vault for future access. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If the user signs in with username and password, creating a _user session_, @@ -74,7 +86,7 @@ tags: Use the `/api/v2/scripts` endpoints to create and manage scripts. See related guides to learn how to define parameters and execute scripts. - ### Related guides + #### Related guides - [Invoke custom scripts]({{% INFLUXDB_DOCS_URL %}}/api-guide/api-invokable-scripts/) from API requests. - [Create a task that references a script]({{% INFLUXDB_DOCS_URL %}}/process-data/manage-tasks/create-task/#create-a-task-that-references-a-script) @@ -103,7 +115,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -111,7 +123,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/) - [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/) @@ -134,7 +146,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/) - [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/) @@ -149,14 +161,14 @@ tags: `GET /api/v2/users` and `GET /api/v2/users/USER_ID` API endpoints to view specific members. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users]({{% INFLUXDB_DOCS_URL %}}/organizations/users/) - name: Write @@ -237,7 +249,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records, diff --git a/src/common/_paths.yml b/src/common/_paths.yml index 3d9dcfd8d..6f21ef6b9 100644 --- a/src/common/_paths.yml +++ b/src/common/_paths.yml @@ -174,7 +174,3 @@ $ref: "./common/paths/notificationEndpoints_endpointID_labels.yml" "/notificationEndpoints/{endpointID}/labels/{labelID}": $ref: "./common/paths/notificationEndpoints_endpointID_labels_labelID.yml" - /authorizations: - $ref: "./common/paths/authorizations.yml" - /authorizations/{authID}: - $ref: "./common/paths/authorizations_authID.yml" diff --git a/src/common/paths/authorizations.yml b/src/common/paths/authorizations.yml index 5dd7be749..53491a4fd 100644 --- a/src/common/paths/authorizations.yml +++ b/src/common/paths/authorizations.yml @@ -1,7 +1,7 @@ get: operationId: GetAuthorizations tags: - - Authorizations (API tokens) + - Authorizations - Security and access endpoints summary: List authorizations description: | @@ -10,19 +10,16 @@ get: To limit which authorizations are returned, pass query parameters in your request. If no query parameters are passed, InfluxDB returns all authorizations. - #### InfluxDB Cloud + #### InfluxDB OSS - - InfluxDB Cloud doesn't expose [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) - values in `GET /api/v2/authorizations` responses; - returns `token: redacted` for all authorizations. + - InfluxDB OSS returns + [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations. + - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, + InfluxDB OSS returns authorizations for all organizations in the instance. #### Required permissions - To retrieve an authorization, the request must use an API token that has the - following permissions: - - - `read-authorizations` - - `read-user` for the user that the authorization is scoped to + - An _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_. #### Related guides @@ -57,40 +54,9 @@ get: description: | An organization name. Only returns authorizations that belong to the specified [organization]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#organization). - - in: query - name: token - schema: - type: string - description: | - An API [token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) value. - Specifies an authorization by its `token` property value - and returns the authorization. - - #### InfluxDB OSS - - - Doesn't support this parameter. InfluxDB OSS ignores the `token=` parameter, - applies other parameters, and then returns the result. - - #### Limitations - - - The parameter is non-repeatable. If you specify more than one, - only the first one is used. If a resource with the specified - property value doesn't exist, then the response body contains an empty list. responses: "200": - description: | - Success. The response body contains a list of authorizations. - - If the response body is missing authorizations that you expect, check that the API - token used in the request has `read-user` permission for the users (`userID` property value) - in those authorizations. - - #### InfluxDB OSS - - - **Warning**: The response body contains authorizations with their - [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in clear text. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. + description: Success. The response body contains a list of authorizations. content: application/json: schema: @@ -108,8 +74,7 @@ get: post: operationId: PostAuthorizations tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations summary: Create an authorization description: | Creates an authorization and returns the authorization with the @@ -117,24 +82,21 @@ post: Use this endpoint to create an authorization, which generates an API token with permissions to `read` or `write` to a specific resource or `type` of resource. - The API token is the authorization's `token` property value. + The response contains the new authorization with the generated API token. + + #### Limitations To follow best practices for secure API token generation and retrieval, InfluxDB enforces access restrictions on API tokens. - - InfluxDB allows access to the API token value immediately after the authorization is created. - - You can’t change access (read/write) permissions for an API token after it’s created. - - Tokens stop working when the user who created the token is deleted. - - We recommend the following for managing your tokens: - - - Create a generic user to create and manage tokens for writing data. - - Store your tokens in a secure password vault for future access. - - #### Required permissions + - In InfluxDB OSS, API tokens are visible to the user who created the authorization and to any + user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_. + - You can't update an authorization's permissions. + - Even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + - A token stops working when the user who created the authorization is deleted. - - `write-authorizations` - - `write-user` for the user that the authorization is scoped to + We recommend creating a generic user to create and manage tokens for writing data. #### Related guides @@ -158,8 +120,7 @@ post: responses: "201": description: | - Success. The authorization is created. The response body contains the - authorization. + Success. The authorization is created. The response body contains the authorization. content: application/json: schema: diff --git a/src/common/paths/authorizations_authID.yml b/src/common/paths/authorizations_authID.yml index a31a0d782..768e62822 100644 --- a/src/common/paths/authorizations_authID.yml +++ b/src/common/paths/authorizations_authID.yml @@ -1,28 +1,9 @@ get: operationId: GetAuthorizationsID tags: - - Authorizations (API tokens) + - Authorizations - Security and access endpoints summary: Retrieve an authorization - description: | - Retrieves an authorization. - - Use this endpoint to retrieve information about an API token, including - the token's permissions and the user that the token is scoped to. - - #### InfluxDB OSS - - - InfluxDB OSS returns - [API token]({{% INFLUXDB_DOCS_URL %}}/reference/glossary/#token) values in authorizations. - - If the request uses an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token)_, - InfluxDB OSS returns authorizations for all organizations in the instance. - - #### Related guides - - - [View tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/) - externalDocs: - url: "{{% INFLUXDB_DOCS_URL %}}/security/tokens/view-tokens/" - description: View tokens parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: path @@ -30,64 +11,24 @@ get: schema: type: string required: true - description: An authorization ID. Specifies the authorization to retrieve. + description: The ID of the authorization to get. responses: "200": - description: Success. The response body contains the authorization. + description: Authorization details content: application/json: schema: $ref: "../../common/schemas/Authorization.yml" - "400": - description: | - Bad request. - content: - application/json: - schema: - $ref: "../schemas/Error.yml" - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - "401": - $ref: "../responses/AuthorizationError.yml" - "404": - description: | - Not found. - content: - application/json: - schema: - $ref: "../schemas/Error.yml" - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: { - "code": "not found", - "message": "authorization not found" - } - "500": - $ref: "../responses/InternalServerError.yml" default: description: Unexpected error $ref: '../../common/responses/ServerError.yml' patch: operationId: PatchAuthorizationsID tags: - - Authorizations (API tokens) - - Security and access endpoints - summary: Update an API token to be active or inactive - description: | - Updates an authorization. - - Use this endpoint to set an API token's status to be _active_ or _inactive_. - InfluxDB rejects requests that use inactive API tokens. + - Authorizations + summary: Update an authorization to be active or inactive requestBody: - description: In the request body, provide the authorization properties to update. + description: Authorization to update required: true content: application/json: @@ -100,10 +41,10 @@ patch: schema: type: string required: true - description: An authorization ID. Specifies the authorization to update. + description: The ID of the authorization to update. responses: "200": - description: Success. The response body contains the updated authorization. + description: The active or inactive authorization content: application/json: schema: @@ -114,16 +55,8 @@ patch: delete: operationId: DeleteAuthorizationsID tags: - - Authorizations (API tokens) - - Security and access endpoints + - Authorizations summary: Delete an authorization - description: | - Deletes an authorization. - - Use the endpoint to delete an API token. - - If you want to disable an API token instead of delete it, - [update the authorization's status to `inactive`](#operation/PatchAuthorizationsID). parameters: - $ref: "../../common/parameters/TraceSpan.yml" - in: path @@ -131,44 +64,10 @@ delete: schema: type: string required: true - description: An authorization ID. Specifies the authorization to delete. + description: The ID of the authorization to delete. responses: "204": - description: Success. The authorization is deleted. - "400": - description: | - Bad request. - content: - application/json: - schema: - $ref: "../schemas/Error.yml" - examples: - notFound: - summary: | - The specified resource ID is invalid. - value: { - "code": "invalid", - "message": "id must have a length of 16 bytes" - } - "401": - $ref: "../responses/AuthorizationError.yml" - "404": - description: | - Not found. - content: - application/json: - schema: - $ref: "../schemas/Error.yml" - examples: - notFound: - summary: | - The requested authorization doesn't exist. - value: { - "code": "not found", - "message": "authorization not found" - } - "500": - $ref: "../responses/InternalServerError.yml" + description: Authorization deleted default: description: Unexpected error $ref: '../../common/responses/ServerError.yml' diff --git a/src/common/paths/buckets_bucketID_owners.yml b/src/common/paths/buckets_bucketID_owners.yml index 6c324a1de..13daf62b9 100644 --- a/src/common/paths/buckets_bucketID_owners.yml +++ b/src/common/paths/buckets_bucketID_owners.yml @@ -13,7 +13,7 @@ get: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -29,7 +29,7 @@ get: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides @@ -84,7 +84,7 @@ post: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -99,7 +99,7 @@ post: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides diff --git a/src/common/paths/buckets_bucketID_owners_userID.yml b/src/common/paths/buckets_bucketID_owners_userID.yml index 1f1880642..e07b24e8b 100644 --- a/src/common/paths/buckets_bucketID_owners_userID.yml +++ b/src/common/paths/buckets_bucketID_owners_userID.yml @@ -11,7 +11,7 @@ delete: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -27,7 +27,7 @@ delete: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) #### Related guides diff --git a/src/common/paths/flags.yml b/src/common/paths/flags.yml index 3fe197944..6154641be 100644 --- a/src/common/paths/flags.yml +++ b/src/common/paths/flags.yml @@ -14,7 +14,7 @@ get: 1. Use [token authentication](#section/Authentication/TokenAuthentication) or a [user session](#tag/Signin) with this endpoint to retrieve feature flags and their values. - 2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/#feature-flags). + 2. Follow the instructions to [enable, disable, or override values for feature flags]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/#feature-flags). 3. **Optional**: To confirm that your change is applied, do one of the following: - Send a request to this endpoint to retrieve the current feature flag values. @@ -23,7 +23,7 @@ get: #### Related guides - - [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/reference/config-options/) + - [InfluxDB configuration options]({{% INFLUXDB_DOCS_URL %}}/influxdb/v2.4/reference/config-options/) parameters: - $ref: "../parameters/TraceSpan.yml" responses: diff --git a/src/common/paths/orgs_orgID_members.yml b/src/common/paths/orgs_orgID_members.yml index c91c14a1b..64a3e3b19 100644 --- a/src/common/paths/orgs_orgID_members.yml +++ b/src/common/paths/orgs_orgID_members.yml @@ -16,7 +16,7 @@ get: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -99,7 +99,7 @@ post: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations diff --git a/src/common/paths/orgs_orgID_members_userID.yml b/src/common/paths/orgs_orgID_members_userID.yml index 4f149fd44..9c3b66de7 100644 --- a/src/common/paths/orgs_orgID_members_userID.yml +++ b/src/common/paths/orgs_orgID_members_userID.yml @@ -14,7 +14,7 @@ delete: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations diff --git a/src/common/paths/orgs_orgID_owners.yml b/src/common/paths/orgs_orgID_owners.yml index 9d1f3f586..001c1ee57 100644 --- a/src/common/paths/orgs_orgID_owners.yml +++ b/src/common/paths/orgs_orgID_owners.yml @@ -10,7 +10,7 @@ get: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -61,7 +61,7 @@ post: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Required permissions @@ -71,7 +71,7 @@ post: #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: "../parameters/TraceSpan.yml" - in: path diff --git a/src/common/paths/orgs_orgID_owners_userID.yml b/src/common/paths/orgs_orgID_owners_userID.yml index bdfa0f626..1d5320c01 100644 --- a/src/common/paths/orgs_orgID_owners_userID.yml +++ b/src/common/paths/orgs_orgID_owners_userID.yml @@ -13,7 +13,7 @@ delete: #### InfluxDB Cloud - Doesn't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. #### Limitations @@ -28,7 +28,7 @@ delete: remove an owner from. #### Related endpoints - - [Authorizations](#tag/Authorizations-(API-tokens)) + - [Authorizations](#tag/Authorizations) parameters: - $ref: "../parameters/TraceSpan.yml" - in: path diff --git a/src/common/paths/tasks_taskID_members.yml b/src/common/paths/tasks_taskID_members.yml index 7d4cb763c..0b72dd50b 100644 --- a/src/common/paths/tasks_taskID_members.yml +++ b/src/common/paths/tasks_taskID_members.yml @@ -38,7 +38,7 @@ post: summary: Add a member to a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Adds a user to members of a task and returns the member. parameters: diff --git a/src/common/paths/tasks_taskID_owners.yml b/src/common/paths/tasks_taskID_owners.yml index ed2615930..08e6a586f 100644 --- a/src/common/paths/tasks_taskID_owners.yml +++ b/src/common/paths/tasks_taskID_owners.yml @@ -6,7 +6,7 @@ get: summary: List all owners of a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Retrieves all users that have owner permission for a task. parameters: @@ -58,7 +58,7 @@ post: summary: Add an owner for a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. Assigns a task `owner` role to a user. diff --git a/src/common/paths/tasks_taskID_owners_userID.yml b/src/common/paths/tasks_taskID_owners_userID.yml index e319e00be..4df6d8773 100644 --- a/src/common/paths/tasks_taskID_owners_userID.yml +++ b/src/common/paths/tasks_taskID_owners_userID.yml @@ -6,7 +6,7 @@ delete: summary: Remove an owner from a task description: | **Deprecated**: Tasks don't use `owner` and `member` roles. - Use [`/api/v2/authorizations`](#tag/Authorizations-(API-tokens)) to assign user permissions. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: "../parameters/TraceSpan.yml" diff --git a/src/common/schemas/AuthorizationUpdateRequest.yml b/src/common/schemas/AuthorizationUpdateRequest.yml index c07b46ce1..598a251a4 100644 --- a/src/common/schemas/AuthorizationUpdateRequest.yml +++ b/src/common/schemas/AuthorizationUpdateRequest.yml @@ -1,6 +1,6 @@ properties: status: - description: Status of the token. If `inactive`, InfluxDB rejects requests that use the token. + description: Status of the token. If `inactive`, requests using the token will be rejected. default: active type: string enum: diff --git a/src/common/schemas/RetentionRule.yml b/src/common/schemas/RetentionRule.yml index eff37f335..68bd9ca51 100644 --- a/src/common/schemas/RetentionRule.yml +++ b/src/common/schemas/RetentionRule.yml @@ -29,5 +29,5 @@ #### InfluxDB OSS - Default value depends on the - [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/reference/internals/shards/#shard-group-duration). + [bucket retention period]({{% INFLUXDB_DOCS_URL %}}/v2.3/reference/internals/shards/#shard-group-duration). required: [everySeconds] diff --git a/src/legacy/schemas/LegacyAuthorizationPostRequest.yml b/src/legacy/schemas/LegacyAuthorizationPostRequest.yml index 818c5a012..5b572add1 100644 --- a/src/legacy/schemas/LegacyAuthorizationPostRequest.yml +++ b/src/legacy/schemas/LegacyAuthorizationPostRequest.yml @@ -5,18 +5,18 @@ allOf: properties: orgID: type: string - description: The organization ID. Identifies the organization that the authorization is scoped to. + description: The ID of the organization that the authorization is scoped to. userID: type: string - description: The user ID. Identifies the user that the authorization is scoped to. + description: The ID of the user that the authorization is scoped to. token: type: string - description: The name that you provide for the authorization. + description: A name that you provide for the authorization. permissions: type: array minItems: 1 description: | - The list of permissions that provide `read` and `write` access to organization resources. + A list of permissions that provide `read` and `write` access to organization resources. An authorization must contain at least one permission. items: $ref: "../../common/schemas/Permission.yml" diff --git a/src/oss.yml b/src/oss.yml index 59e238276..a16b7ef5c 100644 --- a/src/oss.yml +++ b/src/oss.yml @@ -45,6 +45,10 @@ paths: $ref: "./common/paths/users_userID.yml" /setup: $ref: "./common/paths/setup.yml" + /authorizations: + $ref: "./common/paths/authorizations.yml" + /authorizations/{authID}: + $ref: "./common/paths/authorizations_authID.yml" /variables: $ref: "./common/paths/variables.yml" "/variables/{variableID}": @@ -221,7 +225,7 @@ components: # # For more information and examples, see the following: # - # - [`/authorizations`(#tag/Authorizations-(API-tokens)) endpoints] + # - [`/authorizations`(#tag/Authorizations) endpoints] # - [Authorize API requests]({{% INFLUXDB_DOCS_URL %}}/api-guide/api_intro/#authentication) # - [Manage API tokens]({{% INFLUXDB_DOCS_URL %}}/security/tokens/) TokenAuthentication: @@ -258,7 +262,7 @@ components: ### Related endpoints - - [`/authorizations` endpoints](#tag/Authorizations-(API-tokens)) + - [`/authorizations` endpoints](#tag/Authorizations) ### Related guides diff --git a/src/oss/tags.yml b/src/oss/tags.yml index ac52996e7..11dfb2de0 100644 --- a/src/oss/tags.yml +++ b/src/oss/tags.yml @@ -1,5 +1,5 @@ tags: - - name: Authorizations (API tokens) + - name: Authorizations description: | Create and manage authorizations (API tokens). @@ -7,9 +7,23 @@ tags: permissions for organization resources and provides an API token for authentication. An authorization belongs to an organization and only contains permissions for that organization. + #### Limitations + + To follow best practices for secure API token generation and retrieval, + InfluxDB enforces access restrictions on API tokens. + + - InfluxDB allows access to the API token value immediately after the authorization is created. + - You can’t change access (read/write) permissions for an API token after it’s created. + - Tokens stop working when the user who created the token is deleted. + + API tokens are visible to the user who created the authorization and to any + user with an _[operator token]({{% INFLUXDB_DOCS_URL %}}/security/tokens/#operator-token)_. + In InfluxDB OSS, even if an API token has `read-authorizations` permission, the + token can't be used to view its authorization details. + We recommend creating a generic user to create and manage tokens for writing data. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, when creating an authorization, you can scope it to a specific user. If a user signs in with username and password, creating a _user session_, @@ -93,7 +107,7 @@ tags: - ### Properties + #### Properties A `task` object contains information about an InfluxDB task resource. @@ -101,7 +115,7 @@ tags: - ### Related guides + #### Related guides - [Get started with tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/get-started/) - [Common data processing tasks]({{% INFLUXDB_DOCS_URL %}}/process-data/common-tasks/) @@ -125,7 +139,7 @@ tags: Use the `/api/v2/stacks` endpoints to manage installed template resources. - ### Related guides + #### Related guides - [InfluxDB stacks]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/stacks/) - [InfluxDB templates]({{% INFLUXDB_DOCS_URL %}}/influxdb-templates/) @@ -136,14 +150,14 @@ tags: To grant a user permission to access data, add them as a member of an organization and provide them with an API token. - ### User sessions with authorizations + #### User sessions with authorizations Optionally, you can scope an authorization (and its API token) to a user. If a user signs in with username and password, creating a _user session_, the session carries the permissions granted by all the user's authorizations. To create a user session, use the [`POST /api/v2/signin` endpoint](#operation/PostSignin). - ### Related guides + #### Related guides - [Manage users]({{% INFLUXDB_DOCS_URL %}}/influxdb/latest/users/) - [Create a token scoped to a user]({{% INFLUXDB_DOCS_URL %}}/latest/security/tokens/create-token/#create-a-token-scoped-to-a-user) @@ -225,7 +239,7 @@ tags: | `offset` | integer | The number of records to skip (before `limit`, after other parameters are applied). | | `after` | string (resource ID) | Only returns resources created after the specified resource. | - ### Limitations + #### Limitations - For specific endpoint parameters and examples, see the endpoint definition. - If you specify an `offset` parameter value greater than the total number of records,