docs-v2/api-docs
Scott Anderson 20a409294f
InfluxDB OSS 2.4 (#4361)
* created OSS 2.4

* port nav-item shortcode fixes to 2.4

* update set() example in influxdb faq

* port schema exploration updates to 2.4

* replace indexDB with InfluxDB

* OSS and Enterprise FAQ update (#4310)

* add info about relative time ranges and task retries, closes influxdata/EAR#3415

* add delete faqs, closes influxdata/EAR#3412

* restructure enterprise faq, add entropy faq, closes influxdata/EAR#3364

* add faq about total query time, closes influxdata/EAR#3509

* port MQTT changes into influxdb 2.4

* Influx CLI 2.4 (#4340)

* feat: added CLI scripts documentation (#4223)

* feat: added CLI scripts documentation

* chore: address feedback

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

* chore: more feedback

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

* moved scripts cli docs into 2.4

* Add users to an org as an owner and other fixes (#4258)

* document adding users to an org as an owner and other fixes, closes #4171

* update content around owners

* InfluxQL shell documentation (#4263)

* added influx v1 shell command docs, closes #4173

* add influxql shell process docs, closes #4172

* add links to influxql shell process docs

* Apply suggestions from code review

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* feat: documented invokable scripts within tasks functionality in the CLI (#4295)

* feat: documented invokable scripts within tasks functionality in the CLI

* chore: added updated_in frontmatter

* add information about cli configs with username/password (#4328)

Co-authored-by: Andrew Depke <andrewdepke@gmail.com>
Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* influx CLI 2.4 release notes (#4267)

* feat: added CLI scripts documentation (#4223)

* feat: added CLI scripts documentation

* chore: address feedback

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

* chore: more feedback

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

* moved scripts cli docs into 2.4

* influx CLI 2.4 release notes

* Update content/influxdb/v2.4/reference/release-notes/influx-cli.md

* update release notes with cli username/password support

Co-authored-by: Andrew Depke <andrewdepke@gmail.com>

* 2.4 Virtual DBRPs (#4342)

* WIP auto-add dbrp

* add dbrp management docs

* Update replication docs for InfluxDB 2.4 (#4343)

* update replication docs

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>

* Apply suggestions from code review

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>

Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>

* port postman install update to 2.4

* port influx stacks init fix to all influxdb versions

* API docs for 2.4 (#4357)

* api docs for 2.4

* updated to latest swaggerV1Compat.yml

* update edge.js

* Oss 2.4 release notes (#4352)

* added initial notes

* added updates

* updated the release notes

* made a few updates, changed TBD

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: Sam Dillard <sam@influxdata.com>

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

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

* Update content/influxdb/v2.4/reference/release-notes/influxdb.md

Co-authored-by: Sam Dillard <sam@influxdata.com>
Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* added date to influx-cli 2.4.0 release

Co-authored-by: lwandzura <51929958+lwandzura@users.noreply.github.com>
Co-authored-by: Andrew Depke <andrewdepke@gmail.com>
Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>
Co-authored-by: Sam Dillard <sam@influxdata.com>
2022-08-19 10:27:54 -05:00
..
cloud chore(api): update Cloud and v2.3 API specs with latest openapi updates. (#4265) 2022-07-28 16:21:09 -05:00
openapi Chore/lint api defs (#4334) 2022-08-12 11:48:21 -05:00
v2.0 base update to 2.2 (#3744) 2022-04-06 15:07:21 -07:00
v2.1 Fix/api reference (#3977) 2022-04-26 17:16:36 -05:00
v2.2 fix: replace download button with spec link. (#4013) 2022-05-12 16:48:02 -05:00
v2.3 chore(api): update Cloud and v2.3 API specs with latest openapi updates. (#4265) 2022-07-28 16:21:09 -05:00
v2.4 InfluxDB OSS 2.4 (#4361) 2022-08-19 10:27:54 -05:00
.redocly.yaml chore: update property names in redocly config. (#4329) 2022-08-12 10:31:21 -05:00
README.md fix api-docs tagging command (#4358) 2022-08-19 09:57:53 -05:00
generate-api-docs.sh Chore/improve api docs generation (#4196) 2022-07-08 16:30:02 -05:00
getswagger.sh Chore/lint api defs (#4334) 2022-08-12 11:48:21 -05:00
package.json API Ref docs processing (#3337) 2021-11-03 14:18:02 -05:00
template.hbs Install dependencies as project dependencies from NPM repo (#2476) 2021-05-24 12:11:01 -05:00
yarn.lock API Ref docs processing (#3337) 2021-11-03 14:18:02 -05:00

README.md

API reference documentation

TL;DR: validate and test your local influxdata/openapi changes

  1. After you've edited influxdata/openapi definitions, you need to generate and validate contracts and test the API reference docs. To create a shell alias that does this, open your ~/.profile in an editor and add the following commands to the file:

    export DOCS="$HOME/github/docs-v2"
    alias gsd="cd $HOME/github/openapi && make generate-all && \
               npx oats ./contracts/ref/cloud.yml && npx oats ./contracts/ref/oss.yml && \
               cd $DOCS/api-docs && ./getswagger.sh all -b file:///$HOME/github/openapi && \
               sh ./generate-api-docs.sh"
    
  2. To refresh your environment with the ~/.profile changes, enter the following command into your terminal:

    source ~/.profile
    
  3. To run the alias, enter the following command into your terminal:

    gsd
    

gsd generates the local contracts in ~/github/openapi, validates them with OATS, bundles and lints them with @redocly/cli, and then generates the HTML with @redocly/cli.

Update API docs for InfluxDB Cloud

  1. In your docs-v2 directory, create a branch for your changes--for example:

    cd ~/github/docs-v2
    git fetch -ap
    git checkout -b release/api-cloud origin/master
    
  2. Enter the following commands into your terminal to fetch and process the contracts:

    # In your terminal, go to the `docs-v2/api-docs` directory:
    cd ./api-docs
    
    # Fetch the contracts, apply customizations, and bundle.
    sh getswagger.sh cloud
    
  3. To generate the HTML files for local testing, follow the instructions to generate API docs locally.

  4. To commit your updated spec files, push your branch to influxdata/docs-v2, and create a PR against the master branch.

Update API docs for an InfluxDB OSS release

  1. Go into your local influxdata/openapi repo directory--for example:

    cd ~/github/openapi
    
  2. Get the SHA for the release commit (or consult Team-Edge if you're not sure)--for example, enter the following command into your terminal to get the latest SHA for contracts/ref/oss.yml :

    git log -n 1 --pretty=format:%h -- contracts/ref/oss.yml
    
  3. Copy the SHA from the output and create a git tag by running the following command, replacing [SEMANTIC_VERSION] with the OSS release (for example, 2.3.0) and COMMIT_SHA with the SHA from step 2:

    git tag influxdb-oss-v[SEMANTIC_VERSION] COMMIT_SHA
    
  4. Enter the following commands into your terminal to push the new tag to the repo:

    git push --tags
    
  5. Enter the following commands into your terminal to update docs-release/influxdb-oss branch to the OSS release commit and rebase the branch to the latest release of InfluxDB OSS, replacing OSS_RELEASE_TAG with the SHA from step 3.

    git checkout docs-release/influxdb-oss
    git rebase -i OSS_RELEASE_TAG
    git push -f origin docs-release/influxdb-oss
    
  6. Go into your docs-v2 directory and create a branch for your changes--for example:

    cd ~/github/docs-v2
    git fetch -ap
    git checkout -b release/api-oss origin/master
    
  7. In ./api-docs, create a directory for the new OSS version number--for example:

    # In your terminal, go to the `docs-v2/api-docs` directory:
    cd ./api-docs
    
    # Create the directory:
    mkdir v2.3
    
  8. Enter the following commands into your terminal to fetch and process the contracts:

    # Fetch the contracts, apply customizations, and bundle.
    sh getswagger.sh oss
    
  9. To generate the HTML files for local testing, follow the instructions to generate API docs locally.

  10. To commit your updated spec files, push your branch to influxdata/docs-v2, and create a PR against the master branch.

Update API docs for OSS spec changes between releases

Follow these steps to update OSS API docs between version releases--for example, after revising description fields in influxdata/openapi.

  1. Go into your local influxdata/openapi repo directory--for example:

    cd ~/github/openapi
    
  2. Enter the following commands into your terminal to checkout docs-release/influxdb-oss branch:

    git fetch -ap
    git checkout -t docs-release/influxdb-oss
    
  3. Cherry-pick the commits with the updated description fields, and push the commits to the remote branch, replacing [COMMIT_SHAs] (one or more commit SHAs (space-separated))--for example:

    git cherry-pick [COMMIT_SHAs]
    git push -f origin docs-release/influxdb-oss
    
    
  4. Go into your docs-v2 directory and create a branch for your changes--for example:

    cd ~/github/docs-v2
    git fetch -ap
    git checkout -b docs/api-oss origin/master
    
  5. Go into ./api-docs directory--for example:

    # In your terminal, go to the `docs-v2/api-docs` directory:
    cd ./api-docs
    
  6. Enter the following commands into your terminal to fetch and process the contracts:

    # Fetch the contracts, apply customizations, and bundle.
    sh getswagger.sh oss
    
  7. To generate the HTML files for local testing, follow the instructions to generate API docs locally.

  8. To commit your updated spec files, push your branch to influxdata/docs-v2, and create a PR against the master branch.

Generate InfluxDB API docs

InfluxData uses Redoc, redoc-cli, and Redocly's OpenApi CLI to generate API documentation from the InfluxDB OpenAPI (aka Swagger) contracts.

To minimize the size of the docs-v2 repository, the generated API documentation HTML is gitignored, therefore not committed to the docs repo. The InfluxDB docs deployment process uses OpenAPI specification files in the api-docs directory to generate version-specific (Cloud, OSS v2.1, OSS v2.0, etc.) API documentation.

Generate API docs locally

Because the API documentation HTML is gitignored, you must manually generate it to view the API docs locally.

The ./generate.sh script uses the Redoc CLI to generate Redocly HTML, Javascript, and CSS for each version of the InfluxDB spec. The script uses npx to download and execute the Redocly CLI.

  1. Verify that you have a working npx (it's included with Node.js). In your terminal, run:

    npx --version
    

    If npx returns errors, download and run a recent version of the Node.js installer for your OS.

  2. To generate API docs for all InfluxDB versions in ./openapi, enter the following command into your terminal:

    sh generate-api-docs.sh
    

    To save time testing your spec changes, you can pass the -c flag to regenerate HTML for only the OpenAPI files that differ from your master branch.

    sh generate-api-docs.sh -c
    

How we version OpenAPI contracts

The api-docs directory structure versions OpenAPI files using the following pattern:

api-docs/
  |-- cloud/
  │     └── ref.yml
  │     └── swaggerV1Compat.yml
  ├── v2.0/
  │     └── ref.yml
  │     └── swaggerV1Compat.yml
  ├── v2.1/
  │     └── ref.yml
  │     └── swaggerV1Compat.yml
  ├── v2.2/
  │     └── ref.yml
  │     └── swaggerV1Compat.yml
  └── etc...

InfluxDB Cloud version

InfluxDB Cloud releases are frequent and not versioned, so the Cloud API spec isn't versioned. We regenerate API reference docs from influxdata/openapi master branch as features are released.

InfluxDB OSS version

Given that influxdata/openapi master may contain OSS spec changes not implemented in the current OSS release, we (Docs team) maintain a release branch, influxdata/openapi docs-release/influxdb-oss, used to generate OSS reference docs.

How to find the API spec used by an InfluxDB OSS version

influxdata/openapi does not version the InfluxData API. To find the influxdata/openapi commit SHA used in a specific version of InfluxDB OSS, see /scripts/fetch-swagger.sh in influxdata/influxdb--for example, for the influxdata/openapi commit used in OSS v2.2.0, see https://github.com/influxdata/influxdb/blob/v2.2.0/scripts/fetch-swagger.sh#L13=. For convenience, we tag influxdata/influxdb (OSS) release points in influxdata/openapi as influxdb-oss-v[OSS_VERSION]. See https://github.com/influxdata/openapi/tags.

How to use custom OpenAPI spec processing

Generally, you should manage API content in influxdata/openapi. In some cases, however, you may want custom processing (e.g. collecting all Tags) or additional content (e.g. describing the reference documentation) specifically for the docs.

When you run getswagger.sh, it executes @redocly/openapi-cli and the plugins listed in .redocly.yaml. ./openapi/plugins use ./openapi/plugins/decorators to apply custom processing to OpenAPI specs.

.yml files in ./openapi/content set content for sections (nodes) in the contract. To update the content for those nodes, you only need to update the YAML files. To add new YAML files for other nodes in the contracts, configure the new content YAML file in ./openapi/content/content.js. The content structure and Markdown must be valid OAS.

Then, you'll need to write or update a decorator module for the node and configure the decorator in the plugin, e.g. ./openapi/plugins/docs-plugin.js. See the complete list of OAS v3.0 nodes.

@redocly/openapi-cli requires that modules use CommonJS require syntax for imports.

How to add tag content or describe a group of paths

In API reference docs, we use OpenAPI tags elements for navigation and the x-traitTag vendor extension to define custom content.

Example OpenAPI field
Add supplementary documentation tags: [ { name: 'Quick start', x-traitTag: true } ] Source
Group and describe related paths tags: [ { name: 'Buckets', description: '...' } ] Source)

How to test your spec or API reference changes

You can use getswagger.sh to fetch contracts from any URL. For example, if you've made changes to spec files and generated new contracts in your local openapi repo, run getswagger.sh to fetch and process them.

To fetch contracts from your own openapi repo, pass the -b base_url option and the full path to your openapi directory.

# Use the file:/// protocol to pass your openapi directory.
sh getswagger.sh oss -b file:///Users/me/github/openapi

After you fetch them, run the linter or generate HTML to test your changes before you commit them to influxdata/openapi. By default, getswagger.sh doesn't run the linter when bundling the specs. Manually run the linter rules to get a report of errors and warnings.

npx @redocly/openapi-cli lint v2.1/ref.yml

Configure OpenAPI CLI linting and bundling

The .redoc.yaml configuration file sets options for the @redocly/openapi-cli lint and bundle commands. ./openapi/plugins contains custom InfluxData Docs plugins composed of rules (for validating and linting) and decorators (for customizing). For more configuration options, see @redocly/openapi-cli configuration file documentation.