Authorizing an API to an App
Function
This API is used to authorize a specified API to an App. The API authentication mode must be App authentication. The user who creates an App must be the creator of the service to which the API belongs, and the request user must have the update permission on the service to which the API belongs.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v1/{project_id}/services/{service_id}/app-auth-apis/{api_id}/app-auth-api
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID and Name. |
service_id |
Yes |
String |
ID of the service to which the API belongs |
api_id |
Yes |
String |
API ID |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
apps |
Yes |
Array of Apps objects |
App list |
workspace_id |
No |
String |
Workspace ID. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Link trace ID |
Parameter |
Type |
Description |
---|---|---|
auth_result |
Array of AppAuthResultInfo objects |
Authorization result list. |
Parameter |
Type |
Description |
---|---|---|
api_id |
String |
API ID |
app_id |
String |
App ID, which can be obtained by querying apps |
auth_id |
String |
Authorization ID, which is empty if the authorization fails |
reason |
String |
Authorization or authorization cancellation failure reason, which is empty if the authorization is successful |
success |
Boolean |
Whether authorization or authorization cancellation is successful |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Link trace ID |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes of ModelArts. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Link trace ID |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes of ModelArts. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Link trace ID |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes of ModelArts. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Link trace ID |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error codes of ModelArts. |
error_msg |
String |
Error message. |
Example Requests
Authorizing an App to a specified API
POST https://{endpoint}/v1/{project_id}/services/{service_id}/app-auth-apis/{api_id}/app-auth-api { "apps" : [ { "app_id" : "e2fb64be3be9418bb0f570c60f0ed93f" } ] }
Example Responses
Status code: 200
OK
{ "auth_result" : [ { "api_id" : "logic-api-fe84e858-49ec-41c6-80d7-a34fc22435c2", "app_id" : "logic-app-ce0d0a41-451d-4563-94d9-acc75b5e440f", "success" : true } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Server Internal Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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