Querying the Content in the resource and doc Directories of the Asset Center
Function
This API is used to obtain resource files, such as description documents and chip configurations, in the resource and doc directories of a specified asset on ModelArts.
It is used when you need to view additional documents, configuration files, or other static resources of an asset. Before using this API, ensure that you have the project access permission and know the target asset ID and resource file name. The platform reads the corresponding file based on the asset ID and resource name, and automatically returns the content in the corresponding format based on the file type. If the asset does not exist or you do not have the required permissions, the API returns an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:asset:showAssetResource
Read
workspace *
g:EnterpriseProjectId
-
-
asset *
-
URI
GET /v2/{project_id}/assets/{asset_id}/resources
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Huawei Cloud project ID. To obtain a project ID, go to the ModelArts Studio console, press F12 to access the developer tool, refresh the page, find the /rest/me API in the Network tab, and then locate the project_id field in the response of the API. Constraints: The value can contain 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Range: N/A Default Value: N/A |
| asset_id | Yes | String | Definition: Asset ID. Constraints: The value can contain 1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Range: N/A Default Value: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| workspace_id | No | String | Definition: Workspace ID. To obtain the value, click the target project name on the platform, and check the project settings page. Constraints: The value can contain 1 to 32 characters. Only letters and digits are allowed. Range: N/A Default Value: N/A |
| resource_name | Yes | String | Definition: Static resource name. Constraints: Currently, only the README file (docs/RELEASE.md) can be queried. Range: N/A Default Value: N/A |
| check_locale | No | Boolean | Definition: Whether to combine region information during resource query. If this parameter is set to false, the docs/RELEASE.md file is directly queried. If this parameter is set to true, the file with region information is preferentially matched (the request header specifiesx-language, for example, querying docs/RELEASE_en-US.md in English). Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition: User token. During API authentication using a token, the token is added to requests to get permissions for calling the API. To obtain the token, call /v3/auth/tokens of IAM. The value of X-Subject-Token in the response header is the token. Constraints: N/A Range: N/A Default Value: N/A |
Response Parameters
Status code: 200
None
Example Requests
https://{endpoint}/v2/{project_id}/assets/{asset_id}/resources?resource_name={resource_name} Example Responses
None
Status Codes
| Status Code | Description |
|---|---|
| 200 | Binary file stream is returned. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot