It's easy to upload an API to an organisation via SwaggerHub CLI:
swaggerhub api:create OWNER/API_NAME/[VERSION]
But I need to upload an API under some project inside an organisation.
In all examples from https://github.com/SmartBear/swaggerhub-cli there is no "project" variable.
SwaggerHub CLI does not support projects yet. There's an existing feature request for that.
You can, however, use SwaggerHub Registry API to add your uploaded API to a specific project.
curl -X PUT https://api.swaggerhub.com/projects/ORG_NAME/PROJECT_NAME/apis/API_NAME -H "Authorization: YOUR_API_KEY"
If you use self-hosted SwaggerHub On-Premise, the request would be as follows and requires v. 1.26 or later. Add the -k
flag if your instance uses a self-signed or privately signed certificate.
curl -X PUT http(s)://YOUR_SERVER/v1/projects/ORG_NAME/PROJECT_NAME/apis/API_NAME -H "Authorization: YOUR_API_KEY"