added

Say Hello To Versions API and CLI Support!

512

We're proud to offer endpoints for programmatic version control! Now you can manage your project versions directly through our rdme command line interface, or RESTful requests in your application.

If you'd like to to spin up a new version in your CI pipeline for behavioral testing, you can do that too!

Command Line Interface

You can interact with the service for typical CRUD operations:

CommandDescription
rdme versionsGet a single version or multiple versions.
rdme versions:createCreate a new version: Create a new version within your target project. Choose the version to fork from, make it beta, public, or even promote it to your main version.
rdme versions:updateUpdate a version: Allows you to change the beta and public status of a version, codename subtext, deprecate it or make it your main.
rdme versions:deleteDelete a version (if not it's not your main!).

Using the CLI should be consistent with existing interactions; just use the version command! You can find all of the flags and additional documentation for the CLI here: rdme.

rdme login;
rdme versions [--key key] [--version version];

[{ _id: '5d2e58d79f94773b91a12b66',
  forked_from: '5d2d202adf89cf02e963ad0e',
  createdAt: '2019-06-24T23:13:25.571Z',
  is_deprecated: false,
  is_hidden: false,
  is_beta: true,
  is_stable: true,
  codename: 'My First ReadMe Version!',
  version: '1.0' 
 }]
rdme versions:create [--key key] --version={Version} [--fork fork] 
[--main main] [--beta beta] [--codename codename];

Version X.X.X created successfully
rdme versions:update [--key key] --version={Version} [--newVersion newVersion] 
[--main main] [--beta beta] [--codename codename] [--deprecated deprecated];

Version X.X.X updated successfully
rdme versions:delete [--key key] --version={Version};

Version X.X.X deleted successfully

RESTful Requests

You can additionally interact with the versions API as you would with any other traditional REST-oriented service. Be sure to include your authorization via your ReadMe project! Depending on the request, you can provide a selection of body data to create and modify your versions.

curl -X GET \
  https://dash.readme.io/api/v1/version \
  -u ${YOUR_TOKEN}:

curl -X GET \
  https://dash.readme.io/api/v1/version/X.X.X \
 -u ${YOUR_TOKEN}:
curl -X POST \
  https://dash.readme.io/api/v1/version \
  -u ${YOUR_TOKEN}: \
  -d '{
	"version": "NEW_VERSION",
	"from": "FORKED_VERSION",
  	"codename": string, 			//optional parameter
  	"is_stable": boolean,			//optional parameter
  	"is_beta": boolean,			//optional parameter
  	"is_hidden": boolean			//optional parameter
}'
curl -X PUT \
  https://dash.readme.io/api/v1/version/X.X.X \
 -u ${YOUR_TOKEN}: \
  -d '{
	"version": "UPDATED_VERSION",
	"codename": string, 			//optional parameter
  	"is_stable": boolean, 			//optional parameter
  	"is_beta": boolean, 			//optional parameter
  	"is_hidden": boolean, 			//optional parameter
    	"is_deprecated": boolean, 		//optional parameter
}'
curl -X DELETE \
  https://dash.readme.io/api/v1/version/X.X.X \
  -u ${YOUR_TOKEN}:

Conclusion

As an API documentation platform, we at ReadMe are always excited to contribute in the public-facing service space. Programmatic version control has been a much requested feature, and we're happy to offer and support it going forward.

We'll see you at our next Changelog entry!