chore(api-ref): update API ref scripts for v3: (#4949)

* chore(api-ref): update API ref scripts for v3:

- Replace cloud-iox with cloud-serverless and cloud-dedicated in getswagger.sh
- Add cloud-dedicated API ref (handcrafted) with query, write, and ping paths.
- Remove separate v1-compat docs for Serverless and Dedicated.
The v1 paths are included in contracts/ref.
- Add Bearer Auth scheme.
- Remove separate v1 docs buttons from api/_index.md

* Update api-docs/cloud-dedicated/ref.yml

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/cloud-dedicated/ref.yml

---------

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
pull/4952/head
Jason Stirnaman 2023-05-23 13:52:45 -05:00 committed by GitHub
parent a0a794993b
commit 6e01923a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 2174 additions and 513 deletions

View File

@ -0,0 +1,11 @@
title: InfluxDB Cloud Dedicated API Service
description: |
The InfluxDB HTTP API provides a programmatic interface for all interactions with InfluxDB.
Access the InfluxDB API using the `/api/v2/` endpoint.
This documentation is generated from the
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/ref/cloud.yml).
version: Cloud 2.x
license:
name: MIT
url: 'https://opensource.org/licenses/MIT'

View File

@ -0,0 +1,8 @@
- url: https://{baseurl}
description: InfluxDB Cloud Dedicated API URL
variables:
baseurl:
enum:
- 'cluster-id.influxdb.io'
default: 'cluster-id.influxdb.io'
description: InfluxDB Cloud Dedicated URL

View File

@ -0,0 +1,13 @@
- name: Using the InfluxDB HTTP API
tags:
- Quick start
- Authentication
- Headers
- Pagination
- Response codes
- System information endpoints
- name: All endpoints
tags:
- Ping
- Query
- Write

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
title: InfluxDB Cloud Serverless v1 compatibility API documentation
description: |
The InfluxDB 1.x compatibility /write and /query endpoints work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
If you want to use the latest InfluxDB /api/v2 API instead, see the [InfluxDB v2 API documentation](/influxdb/cloud-iox/api/).
This documentation is generated from the
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/swaggerV1Compat.yml).
license:
name: MIT
url: 'https://opensource.org/licenses/MIT'

View File

@ -6726,8 +6726,8 @@ info:
title: InfluxDB Cloud (IOx) API Service
version: Cloud 2.x
description: |
The InfluxDB HTTP API provides a programmatic interface for all interactions with InfluxDB.
Access the InfluxDB API using the `/api/v2/` endpoint.
The InfluxDB HTTP API provides a programmatic interface for interactions with InfluxDB.
Access the InfluxDB API using the `/api/v2/` endpoint or InfluxDB v1 endpoints.
This documentation is generated from the
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/ref/cloud.yml).
@ -15607,7 +15607,7 @@ paths:
- url: /private
/query:
get:
description: Queries InfluxDB using InfluxQL.
description: Queries InfluxDB using InfluxQL with InfluxDB v1 request and response formats.
operationId: GetLegacyQuery
parameters:
- $ref: '#/components/parameters/TraceSpan'
@ -15748,9 +15748,9 @@ paths:
schema:
$ref: '#/components/schemas/Error'
description: Error processing query
summary: Query with the 1.x compatibility API
summary: Query using the InfluxDB v1 API
tags:
- Legacy Query
- Query
/write:
post:
operationId: PostLegacyWrite
@ -15848,9 +15848,9 @@ paths:
schema:
$ref: '#/components/schemas/Error'
description: Internal server error
summary: Write time series data into InfluxDB in a V1-compatible format
summary: Write data using the InfluxDB v1 API
tags:
- Legacy Write
- Write
security:
- TokenAuthentication: []
servers:
@ -15984,8 +15984,6 @@ tags:
name: Invokable Scripts
- name: Labels
- name: Legacy Authorizations
- name: Legacy Query
- name: Legacy Write
- name: Limits
- name: NotificationEndpoints
- name: NotificationRules
@ -16036,14 +16034,20 @@ tags:
x-traitTag: true
- name: Ping
- description: |
Retrieve data, analyze queries, and get query suggestions.
Use the InfluxDB v1 and v2 HTTP APIs with Flux, SQL, or InfluxQL to retrieve data, analyze queries, and get query suggestions.
To get started using Flight and gRPC for querying InfluxDB v3, see the following:
- [Get started with InfluxDB Cloud Serverless](/influxdb/cloud-serverless/get-started/)
- [Query with Flight SQL](/influxdb/cloud-serverless/query-data/execute-queries/flight-sql/)
- [InfluxDB v3 client libraries and Flight clients](/influxdb/cloud-serverless/reference/client-libraries/)
name: Query
- description: |
See the [**API Quick Start**](/influxdb/cloud-serverless/api-guide/api_intro/)
See the [**Get started**](/influxdb/cloud-serverless/get-started/) tutorial
to get up and running authenticating with tokens, writing to buckets, and querying data.
[**InfluxDB API client libraries**](/influxdb/cloud-serverless/api-guide/client-libraries/)
are available for popular languages and ready to import into your application.
[**InfluxDB API client libraries and Flight clients**](/influxdb/cloud-serverless/reference/client-libraries/)
are available to integrate InfluxDB with your application.
name: Quick start
x-traitTag: true
- name: Resources
@ -16176,8 +16180,6 @@ x-tagGroups:
- Delete
- DBRPs
- Invokable Scripts
- Legacy Query
- Legacy Write
- Limits
- Organizations
- Query

View File

@ -1,432 +0,0 @@
openapi: 3.0.0
info:
title: InfluxDB Cloud (IOx) v1 compatibility API documentation
version: 0.1.0
description: |
The InfluxDB 1.x compatibility /write and /query endpoints work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
If you want to use the latest InfluxDB /api/v2 API instead, see the [InfluxDB v2 API documentation](/influxdb/cloud-serverless/api/).
This documentation is generated from the
[InfluxDB OpenAPI specification](https://raw.githubusercontent.com/influxdata/openapi/master/contracts/swaggerV1Compat.yml).
license:
name: MIT
url: https://opensource.org/licenses/MIT
servers:
- url: /
paths:
/write:
post:
operationId: PostWriteV1
tags:
- Write
summary: Write time series data into InfluxDB in a V1-compatible format
requestBody:
description: Line protocol body
required: true
content:
text/plain:
schema:
type: string
parameters:
- $ref: '#/components/parameters/TraceSpan'
- $ref: '#/components/parameters/AuthUserV1'
- $ref: '#/components/parameters/AuthPassV1'
- in: query
name: db
schema:
type: string
required: true
description: Bucket to write to. If none exists, InfluxDB creates a bucket with a default 3-day retention policy.
- in: query
name: rp
schema:
type: string
description: Retention policy name.
- in: query
name: precision
schema:
type: string
description: Write precision.
- in: header
name: Content-Encoding
description: When present, its value indicates to the database that compression is applied to the line protocol body.
schema:
type: string
description: Specifies that the line protocol in the body is encoded with gzip or not encoded with identity.
default: identity
enum:
- gzip
- identity
responses:
'204':
description: Write data is correctly formatted and accepted for writing to the bucket.
'400':
description: Line protocol poorly formed and no points were written. Response can be used to determine the first malformed line in the body line-protocol. All data in body was rejected and not written.
content:
application/json:
schema:
$ref: '#/components/schemas/LineProtocolError'
'401':
description: Token does not have sufficient permissions to write to this organization and bucket or the organization and bucket do not exist.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: No token was sent and they are required.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'413':
description: Write has been rejected because the payload is too large. Error message returns max size supported. All data in body was rejected and not written.
content:
application/json:
schema:
$ref: '#/components/schemas/LineProtocolLengthError'
'429':
description: Token is temporarily over quota. The Retry-After header describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
type: integer
format: int32
'503':
description: Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
type: integer
format: int32
default:
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/query:
post:
operationId: PostQueryV1
tags:
- Query
summary: Query InfluxDB in a V1 compatible format
requestBody:
description: InfluxQL query to execute.
content:
text/plain:
schema:
type: string
parameters:
- $ref: '#/components/parameters/TraceSpan'
- $ref: '#/components/parameters/AuthUserV1'
- $ref: '#/components/parameters/AuthPassV1'
- in: header
name: Accept
schema:
type: string
description: Specifies how query results should be encoded in the response. **Note:** With `application/csv`, query results include epoch timestamps instead of RFC3339 timestamps.
default: application/json
enum:
- application/json
- application/csv
- text/csv
- application/x-msgpack
- in: header
name: Accept-Encoding
description: The Accept-Encoding request HTTP header advertises which content encoding, usually a compression algorithm, the client is able to understand.
schema:
type: string
description: Specifies that the query response in the body should be encoded with gzip or not encoded with identity.
default: identity
enum:
- gzip
- identity
- in: header
name: Content-Type
schema:
type: string
enum:
- application/vnd.influxql
- in: query
name: db
schema:
type: string
required: true
description: Bucket to query.
- in: query
name: rp
schema:
type: string
description: Retention policy name.
- in: query
name: q
description: Defines the influxql query to run.
schema:
type: string
responses:
'200':
description: Query results
headers:
Content-Encoding:
description: The Content-Encoding entity header is used to compress the media-type. When present, its value indicates which encodings were applied to the entity-body
schema:
type: string
description: Specifies that the response in the body is encoded with gzip or not encoded with identity.
default: identity
enum:
- gzip
- identity
Trace-Id:
description: The Trace-Id header reports the request's trace ID, if one was generated.
schema:
type: string
description: Specifies the request's trace ID.
content:
application/csv:
schema:
$ref: '#/components/schemas/InfluxQLCSVResponse'
text/csv:
schema:
$ref: '#/components/schemas/InfluxQLCSVResponse'
application/json:
schema:
$ref: '#/components/schemas/InfluxQLResponse'
application/x-msgpack:
schema:
type: string
format: binary
'429':
description: Token is temporarily over quota. The Retry-After header describes when to try the read again.
headers:
Retry-After:
description: A non-negative decimal integer indicating the seconds to delay after the response is received.
schema:
type: integer
format: int32
default:
description: Error processing query
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
parameters:
TraceSpan:
in: header
name: Zap-Trace-Span
description: OpenTracing span context
example:
trace_id: '1'
span_id: '1'
baggage:
key: value
required: false
schema:
type: string
AuthUserV1:
in: query
name: u
required: false
schema:
type: string
description: Username.
AuthPassV1:
in: query
name: p
required: false
schema:
type: string
description: User token.
schemas:
InfluxQLResponse:
properties:
results:
type: array
oneOf:
- required:
- statement_id
- error
- required:
- statement_id
- series
items:
type: object
properties:
statement_id:
type: integer
error:
type: string
series:
type: array
items:
type: object
properties:
name:
type: string
tags:
type: object
additionalProperties:
type: string
partial:
type: boolean
columns:
type: array
items:
type: string
values:
type: array
items:
type: array
items: {}
InfluxQLCSVResponse:
type: string
example: |
name,tags,time,test_field,test_tag test_measurement,,1603740794286107366,1,tag_value test_measurement,,1603740870053205649,2,tag_value test_measurement,,1603741221085428881,3,tag_value
Error:
properties:
code:
description: Code is the machine-readable error code.
readOnly: true
type: string
enum:
- internal error
- not found
- conflict
- invalid
- unprocessable entity
- empty value
- unavailable
- forbidden
- too many requests
- unauthorized
- method not allowed
message:
readOnly: true
description: Message is a human-readable message.
type: string
required:
- code
- message
LineProtocolError:
properties:
code:
description: Code is the machine-readable error code.
readOnly: true
type: string
enum:
- internal error
- not found
- conflict
- invalid
- empty value
- unavailable
message:
readOnly: true
description: Message is a human-readable message.
type: string
op:
readOnly: true
description: Op describes the logical code operation during error. Useful for debugging.
type: string
err:
readOnly: true
description: Err is a stack of errors that occurred during processing of the request. Useful for debugging.
type: string
line:
readOnly: true
description: First line within sent body containing malformed data
type: integer
format: int32
required:
- code
- message
- op
- err
LineProtocolLengthError:
properties:
code:
description: Code is the machine-readable error code.
readOnly: true
type: string
enum:
- invalid
message:
readOnly: true
description: Message is a human-readable message.
type: string
maxLength:
readOnly: true
description: Max length in bytes for a body of line-protocol.
type: integer
format: int32
required:
- code
- message
- maxLength
securitySchemes:
TokenAuthentication:
type: apiKey
name: Authorization
in: header
description: |
Use the [Token authentication](#section/Authentication/TokenAuthentication)
scheme to authenticate to the InfluxDB API.
In your API requests, send an `Authorization` header.
For the header value, provide the word `Token` followed by a space and an InfluxDB API token.
The word `Token` is case-sensitive.
### Syntax
`Authorization: Token YOUR_INFLUX_TOKEN`
For examples and more information, see the following:
- [`/authorizations`](#tag/Authorizations) endpoint.
- [Authorize API requests](/influxdb/cloud/api-guide/api_intro/#authentication).
- [Manage API tokens](/influxdb/cloud/security/tokens/).
BasicAuthentication:
type: http
scheme: basic
description: |
Use the HTTP [Basic authentication](#section/Authentication/BasicAuthentication)
scheme with clients that support the InfluxDB 1.x convention of username and password (that don't support the `Authorization: Token` scheme):
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
QuerystringAuthentication:
type: apiKey
in: query
name: u=&p=
description: |
Use the [Querystring authentication](#section/Authentication/QuerystringAuthentication)
scheme with InfluxDB 1.x API parameters to provide credentials through the query string.
For examples and more information, see how to [authenticate with a username and password](/influxdb/cloud/reference/api/influxdb-1x/).
security:
- TokenAuthentication: []
- BasicAuthentication: []
- QuerystringAuthentication: []
tags:
- name: Authentication
description: |
The InfluxDB 1.x API requires authentication for all requests.
InfluxDB Cloud uses InfluxDB API tokens to authenticate requests.
For more information, see the following:
- [Token authentication](#section/Authentication/TokenAuthentication)
- [Basic authentication](#section/Authentication/BasicAuthentication)
- [Querystring authentication](#section/Authentication/QuerystringAuthentication)
<!-- ReDoc-Inject: <security-definitions> -->
x-traitTag: true
- name: Query
- name: Write
x-tagGroups: []

View File

@ -12389,10 +12389,6 @@ paths:
Use this endpoint to monitor uptime for the InfluxDB instance. The response
returns a HTTP `204` status code to inform you the instance is available.
#### InfluxDB Cloud
- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers.
#### Related guides
- [Influx ping](/influxdb/cloud/reference/cli/influx/ping/)
@ -12411,9 +12407,6 @@ paths:
X-Influxdb-Version:
description: |
The version of InfluxDB.
#### InfluxDB Cloud
- Doesn't return version.
schema:
type: integer
servers: []
@ -12421,11 +12414,6 @@ paths:
tags:
- Ping
- System information endpoints
x-codeSamples:
- label: cURL
lang: Shell
source: |
curl --request GET "http://localhost:8086/ping"
head:
description: |
Returns the status and InfluxDB version of the instance.
@ -12433,10 +12421,6 @@ paths:
Use this endpoint to monitor uptime for the InfluxDB instance. The response
returns a HTTP `204` status code to inform you the instance is available.
#### InfluxDB Cloud
- Isn't versioned and doesn't return `X-Influxdb-Version` in the headers.
#### Related guides
- [Influx ping](/influxdb/cloud/reference/cli/influx/ping/)
@ -12454,20 +12438,12 @@ paths:
X-Influxdb-Version:
description: |
The version of InfluxDB.
#### InfluxDB Cloud
- Doesn't return version.
schema:
type: integer
servers: []
summary: Get the status of the instance
tags:
- Ping
x-codeSamples:
- label: cURL
lang: Shell
source: |
curl --request HEAD "http://localhost:8086/ping"
/api/v2/query:
post:
description: |

View File

@ -146,20 +146,23 @@ weight: 304
# If the v1 compatibility spec file differs from master, regenerate the HTML.
filePath="${version}/swaggerV1Compat.yml"
update=0
if [[ $generate_changed == 0 ]]; then
fileChanged=$(git diff --name-status master -- ${filePath})
if [[ -z "$fileChanged" ]]; then
update=1
if [ -e "$filePath" ]; then
if [[ $generate_changed == 0 ]]; then
fileChanged=$(git diff --name-status master -- ${filePath})
if [[ -z "$fileChanged" ]]; then
update=1
fi
fi
if [[ $update -eq 0 ]]; then
outFilename="v1-compatibility"
titleSubmodule="v1 compatibility"
generateHtml $filePath $outFilename $titleVersion $titleSubmodule
# Create temp file with frontmatter and Redoc html
echo "$v1compatfrontmatter" >> $version$outFilename.tmp
buildHugoTemplate $version v1 $outFilename
fi
fi
if [[ $update -eq 0 ]]; then
outFilename="v1-compatibility"
titleSubmodule="v1 compatibility"
generateHtml $filePath $outFilename $titleVersion $titleSubmodule
# Create temp file with frontmatter and Redoc html
echo "$v1compatfrontmatter" >> $version$outFilename.tmp
buildHugoTemplate $version v1 $outFilename
fi
done

View File

@ -41,6 +41,8 @@ function showHelp {
echo " With optional arguments:"
echo " ./getswagger.sh <platform> -b <baseUrl> -V"
echo " ./getswagger.sh cloud"
echo " ./getswagger.sh cloud-dedicated"
echo " ./getswagger.sh cloud-serverless"
echo " ./getswagger.sh oss -o <ossVersion> -V"
echo " ./getswagger.sh all -o <ossVersion>"
echo "Commands:"
@ -57,7 +59,7 @@ function showHelp {
subcommand=$1
case "$subcommand" in
cloud-iox|cloud|oss|v1compat|all)
cloud-dedicated|cloud-serverless|cloud|oss|v1compat|all)
platform=$1
shift
@ -132,10 +134,16 @@ function updateCloud {
postProcess $outFile cloud
}
function updateCloudIOx {
outFile="cloud-iox/ref.yml"
function updateCloudDedicated {
outFile="cloud-dedicated/ref.yml"
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
postProcess $outFile cloud-iox
postProcess $outFile cloud-dedicated
}
function updateCloudServerless {
outFile="cloud-serverless/ref.yml"
curl $UPDATE_OPTIONS ${baseUrl}/contracts/ref/cloud.yml -o $outFile
postProcess $outFile cloud-serverless
}
function updateOSS {
@ -167,9 +175,12 @@ fi
if [ "$platform" = "cloud" ];
then
updateCloud
elif [ "$platform" = "cloud-iox" ];
elif [ "$platform" = "cloud-dedicated" ];
then
updateCloudIOx
updateCloudDedicated
elif [ "$platform" = "cloud-serverless" ];
then
updateCloudServerless
elif [ "$platform" = "oss" ];
then
updateOSS
@ -179,7 +190,8 @@ then
elif [ "$platform" = "all" ];
then
updateCloud
updateCloudIOx
updateCloudDedicated
updateCloudServerless
updateOSS
updateV1Compat
else

View File

@ -2,7 +2,7 @@ const path = require('path');
const { toJSON } = require('./helpers/content-helper');
function getVersioned(filename) {
const apiDocsRoot=path.resolve(process.env.API_DOCS_ROOT_PATH);
const apiDocsRoot=path.resolve(process.env.API_DOCS_ROOT_PATH || process.cwd());
const contentPath = path.join(apiDocsRoot, process.env.INFLUXDB_PLATFORM, 'content');
return toJSON(path.join(contentPath, (process.env.INFLUXDB_API_VERSION || ''), filename));

View File

@ -0,0 +1,22 @@
---
title: InfluxDB HTTP API
description: >
The InfluxDB HTTP API provides a programmatic interface for interactions with InfluxDB.
Access the InfluxDB API using the `/api/v2/` endpoint or InfluxDB v1 endpoints.
menu:
influxdb_cloud_dedicated:
parent: Reference
name: InfluxDB HTTP API
weight: 104
influxdb/cloud-dedicated/tags: [api]
aliases:
- /influxdb/cloud-dedicated/api/v1-compatibility/
---
The InfluxDB HTTP API provides a programmatic interface for interactions with InfluxDB.
## InfluxDB HTTP API reference
<a class="btn" href="/influxdb/cloud-dedicated/api/">InfluxDB Cloud Dedicated HTTP API reference</a>
The API reference describes requests and responses for `/api/v2/` endpoints and v1 `/query` and `/write` endpoints.

View File

@ -2,24 +2,21 @@
title: InfluxDB HTTP API
description: >
The InfluxDB HTTP API provides a programmatic interface for interactions with InfluxDB.
Access the InfluxDB API using the `/api/v2/` endpoint.
Access the InfluxDB API using the `/api/v2/` endpoint or InfluxDB v1 endpoints.
menu:
influxdb_cloud_serverless:
parent: Reference
name: InfluxDB HTTP API
weight: 104
influxdb/cloud-serverless/tags: [api]
aliases:
- /influxdb/cloud-serverless/api/v1-compatibility/
---
The InfluxDB HTTP API provides a programmatic interface for interactions with InfluxDB.
Access the InfluxDB HTTP API using the `/api/v2/` endpoint.
## InfluxDB HTTP API documentation
<a class="btn" href="/influxdb/cloud-serverless/api/">InfluxDB Cloud Serverless HTTP API documentation</a>
## InfluxDB HTTP API reference
## InfluxDB v1 compatibility API documentation
The InfluxDB HTTP API includes InfluxDB 1.x compatibility endpoints
that work with InfluxDB 1.x client libraries and third-party integrations like
[Grafana](https://grafana.com) and others.
<a class="btn" href="/influxdb/cloud-serverless/api/">InfluxDB Cloud Serverless HTTP API reference</a>
<a class="btn" href="/influxdb/cloud-serverless/api/v1-compatibility/">InfluxDB Cloud Serverless v1 compatibility HTTP API documentation</a>
The API reference describes requests and responses for `/api/v2/` endpoints and v1 `/query` and `/write` endpoints.