Skip to main content

apis

Creates, updates, deletes, gets or lists an apis resource.

Overview

Nameapis
TypeResource
Idgoogle.apihub.apis

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The name of the API resource in the API Hub. Format: projects/{project}/locations/{location}/apis/{api}
apiFunctionalRequirementsobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
apiRequirementsobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
apiStyleobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
apiTechnicalRequirementsobjectThe attribute values associated with resource. (id: GoogleCloudApihubV1AttributeValues)
attributesobjectOptional. The list of user defined attributes associated with the API resource. The key is the attribute name. It will be of the format: projects/{project}/locations/{location}/attributes/{attribute}. The value is the attribute values associated with the resource.
businessUnitobjectOptional. The business unit owning the API. This maps to the following system defined attribute: projects/{project}/locations/{location}/attributes/system-business-unit attribute. The number of values for this attribute will be based on the cardinality of the attribute. The same can be retrieved via GetAttribute API. All values should be from the list of allowed values defined for the attribute. (id: GoogleCloudApihubV1AttributeValues)
createTimestring (google-datetime)Output only. The time at which the API resource was created.
descriptionstringOptional. The description of the API resource.
displayNamestringRequired. The display name of the API resource.
documentationobjectOptional. The documentation for the API resource. (id: GoogleCloudApihubV1Documentation)
fingerprintstringOptional. Fingerprint of the API resource.
maturityLevelobjectOptional. The maturity level of the API. This maps to the following system defined attribute: projects/{project}/locations/{location}/attributes/system-maturity-level attribute. The number of values for this attribute will be based on the cardinality of the attribute. The same can be retrieved via GetAttribute API. All values should be from the list of allowed values defined for the attribute. (id: GoogleCloudApihubV1AttributeValues)
ownerobjectOptional. Owner details for the API resource. (id: GoogleCloudApihubV1Owner)
selectedVersionstringOptional. The selected version for an API resource. This can be used when special handling is needed on client side for particular version of the API. Format is projects/{project}/locations/{location}/apis/{api}/versions/{version}
sourceMetadataarrayOutput only. The list of sources and metadata from the sources of the API resource.
targetUserobjectOptional. The target users for the API. This maps to the following system defined attribute: projects/{project}/locations/{location}/attributes/system-target-user attribute. The number of values for this attribute will be based on the cardinality of the attribute. The same can be retrieved via GetAttribute API. All values should be from the list of allowed values defined for the attribute. (id: GoogleCloudApihubV1AttributeValues)
teamobjectOptional. The team owning the API. This maps to the following system defined attribute: projects/{project}/locations/{location}/attributes/system-team attribute. The number of values for this attribute will be based on the cardinality of the attribute. The same can be retrieved via GetAttribute API. All values should be from the list of allowed values defined for the attribute. (id: GoogleCloudApihubV1AttributeValues)
updateTimestring (google-datetime)Output only. The time at which the API resource was last updated.
versionsarrayOutput only. The list of versions present in an API resource. Note: An API resource can be associated with more than 1 version. Format is projects/{project}/locations/{location}/apis/{api}/versions/{version}

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, apisIdGet API resource details including the API versions contained in it.
listselectprojectsId, locationsIdfilter, pageSize, pageTokenList API resources in the API hub.
createinsertprojectsId, locationsIdapiIdCreate an API resource in the API hub. Once an API resource is created, versions can be added to it.
patchupdateprojectsId, locationsId, apisIdupdateMaskUpdate an API resource in the API hub. The following fields in the API can be updated: * display_name * description * owner * documentation * target_user * team * business_unit * maturity_level * api_style * attributes The update_mask should be used to specify the fields being updated. Updating the owner field requires complete owner message and updates both owner and email fields.
deletedeleteprojectsId, locationsId, apisIdforceDelete an API resource in the API hub. API can only be deleted if all underlying versions are deleted.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
apisIdstring
locationsIdstring
projectsIdstring
apiIdstring
filterstring
forceboolean
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Get API resource details including the API versions contained in it.

SELECT
name,
apiFunctionalRequirements,
apiRequirements,
apiStyle,
apiTechnicalRequirements,
attributes,
businessUnit,
createTime,
description,
displayName,
documentation,
fingerprint,
maturityLevel,
owner,
selectedVersion,
sourceMetadata,
targetUser,
team,
updateTime,
versions
FROM google.apihub.apis
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND apisId = '{{ apisId }}' -- required;

INSERT examples

Create an API resource in the API hub. Once an API resource is created, versions can be added to it.

INSERT INTO google.apihub.apis (
data__name,
data__displayName,
data__description,
data__documentation,
data__owner,
data__targetUser,
data__team,
data__businessUnit,
data__maturityLevel,
data__attributes,
data__apiStyle,
data__selectedVersion,
data__apiRequirements,
data__fingerprint,
data__apiFunctionalRequirements,
data__apiTechnicalRequirements,
projectsId,
locationsId,
apiId
)
SELECT
'{{ name }}',
'{{ displayName }}',
'{{ description }}',
'{{ documentation }}',
'{{ owner }}',
'{{ targetUser }}',
'{{ team }}',
'{{ businessUnit }}',
'{{ maturityLevel }}',
'{{ attributes }}',
'{{ apiStyle }}',
'{{ selectedVersion }}',
'{{ apiRequirements }}',
'{{ fingerprint }}',
'{{ apiFunctionalRequirements }}',
'{{ apiTechnicalRequirements }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ apiId }}'
RETURNING
name,
apiFunctionalRequirements,
apiRequirements,
apiStyle,
apiTechnicalRequirements,
attributes,
businessUnit,
createTime,
description,
displayName,
documentation,
fingerprint,
maturityLevel,
owner,
selectedVersion,
sourceMetadata,
targetUser,
team,
updateTime,
versions
;

UPDATE examples

Update an API resource in the API hub. The following fields in the API can be updated: * display_name * description * owner * documentation * target_user * team * business_unit * maturity_level * api_style * attributes The update_mask should be used to specify the fields being updated. Updating the owner field requires complete owner message and updates both owner and email fields.

UPDATE google.apihub.apis
SET
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__description = '{{ description }}',
data__documentation = '{{ documentation }}',
data__owner = '{{ owner }}',
data__targetUser = '{{ targetUser }}',
data__team = '{{ team }}',
data__businessUnit = '{{ businessUnit }}',
data__maturityLevel = '{{ maturityLevel }}',
data__attributes = '{{ attributes }}',
data__apiStyle = '{{ apiStyle }}',
data__selectedVersion = '{{ selectedVersion }}',
data__apiRequirements = '{{ apiRequirements }}',
data__fingerprint = '{{ fingerprint }}',
data__apiFunctionalRequirements = '{{ apiFunctionalRequirements }}',
data__apiTechnicalRequirements = '{{ apiTechnicalRequirements }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND apisId = '{{ apisId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
apiFunctionalRequirements,
apiRequirements,
apiStyle,
apiTechnicalRequirements,
attributes,
businessUnit,
createTime,
description,
displayName,
documentation,
fingerprint,
maturityLevel,
owner,
selectedVersion,
sourceMetadata,
targetUser,
team,
updateTime,
versions;

DELETE examples

Delete an API resource in the API hub. API can only be deleted if all underlying versions are deleted.

DELETE FROM google.apihub.apis
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND apisId = '{{ apisId }}' --required
AND force = '{{ force }}';