- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
Add a spec to an API version in the API hub. Multiple specs can be added to an API version. Note, while adding a spec, at least one of contents or sourceUri must be provided. If contents is provided, then specType must also be provided.
On adding a spec with contents to the version, the operations present in it will be added to the version.Note that the file contents in the spec should be of the same type as defined in the projects/{project}/locations/{location}/attributes/system-spec-type attribute associated with spec resource. Note that specs of various types can be uploaded, however parsing of details is supported for OpenAPI spec currently.
In order to access the information parsed from the spec, use the specs.get method. In order to access the raw contents for a particular spec, use the specs.getContents method. In order to access the operations parsed from the spec, use the ListAPIOperations method.
HTTP request
POST https://apihub.googleapis.com/v1/{parent=projects/*/locations/*/apis/*/versions/*}/specs
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
parent |
Required. The parent resource for Spec. Format: |
Query parameters
| Parameters | |
|---|---|
specId |
Optional. The ID to use for the spec, which will become the final component of the spec's resource name. This field is optional.
This value should be 4-500 characters, overall resource name which will be of format |
Request body
The request body contains an instance of Spec.
Response body
If successful, the response body contains a newly created instance of Spec.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
IAM Permissions
Requires the following IAM permission on the parent resource:
apihub.specs.create
For more information, see the IAM documentation.