Creates an API.
Function
An API is created, but the API is not authorized to the app.
URI
POST /v1/{project_id}/app-auth/{service_id}/apis
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        service_id  | 
      
        Yes  | 
      
        String  | 
      
        ID of the service to which the API belongs  | 
     
| 
        project_id  | 
      
        Yes  | 
      
        String  | 
      
        Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed. Range: N/A Default Value: N/A  | 
     
Request Parameters
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        X-Auth-Token  | 
      
        Yes  | 
      
        String  | 
      
        User token, which can be obtained by calling the IAM API that is used for obtaining a user token. The value of X-Subject-Token in the response header is the user token.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        workspace_id  | 
      
        No  | 
      
        String  | 
      
        Workspace ID  | 
     
| 
        support_app_code  | 
      
        No  | 
      
        Boolean  | 
      
        Whether to support the App code  | 
     
| 
        auth_type  | 
      
        No  | 
      
        String  | 
      
        API authentication mode. Options: 
  | 
     
| 
        api_name  | 
      
        No  | 
      
        String  | 
      
        API name  | 
     
| 
        api_url  | 
      
        No  | 
      
        String  | 
      
        URL of the API. with a maximum of 255 characters.  | 
     
| 
        api_path  | 
      
        No  | 
      
        String  | 
      
        Path of the API. with a maximum of 255 characters.  | 
     
| 
        api_method  | 
      
        No  | 
      
        String  | 
      
        Request method, which can be GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, or ANY. ANY is the default value.  | 
     
| 
        api_remark  | 
      
        No  | 
      
        String  | 
      
        API description, with a maximum of 255 characters.  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        api  | 
      
        AuthTypeApiBasicInfo object  | 
      
        API authentication details.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        api_id  | 
      
        String  | 
      
        API ID  | 
     
| 
        api_method  | 
      
        String  | 
      
        Request method, which can be GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, or ANY. ANY is the default value.  | 
     
| 
        api_name  | 
      
        String  | 
      
        API name  | 
     
| 
        api_remark  | 
      
        String  | 
      
        API description. The value contains a maximum of 255 characters.  | 
     
| 
        auth_type  | 
      
        String  | 
      
        API authentication mode. The options are: Enums: 
  | 
     
| 
        predict_url  | 
      
        String  | 
      
        Prediction URL  | 
     
| 
        service_id  | 
      
        String  | 
      
        Service ID  | 
     
| 
        service_name  | 
      
        String  | 
      
        Service name  | 
     
| 
        support_app_code  | 
      
        Boolean  | 
      
        Whether to support the App code  | 
     
Status code: 401
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
       
 Range: N/A  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Definition: Error message. Range: N/A  | 
     
Status code: 403
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
       
 Range: N/A  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Definition: Error message. Range: N/A  | 
     
Status code: 404
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
       
 Range: N/A  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Definition: Error message. Range: N/A  | 
     
Example Requests
POST https://{endpoint}/v1/{project_id}/app-auth/{service_id}/apis
{
  "workspace_id" : "0",
  "support_app_code" : true,
  "auth_type" : "APIG",
  "api_name" : "app_test",
  "api_url" : "https://d566c7efafe04a26a83d3a8475602ee3.apig.xxxxxx.com/v1/infers/456963f1-737c-4de0-8bee-5b4f6f3a8fa3",
  "api_path" : "/v1/infers/456963f1-737c-4de0-8bee-5b4f6f3a8fa3",
  "api_method" : "GET",
  "api_remark" : "test"
}
 Example Responses
Status code: 200
OK
{
  "api" : {
    "api_id" : "7e0d272df0e94297b7d4046bada3f158",
    "api_name" : "infer_ae20fc9fb37c48c28ebc3f3a638c9f48",
    "api_method" : "ANY",
    "predict_url" : "https://b86b2d069324491fbd66940e4533b45c.apig.xxxxxx.com/v1/infers/ae20fc9f-b37c-48c2-8ebc-3f3a638c9f48",
    "support_app_code" : true,
    "service_id" : "ae20fc9f-b37c-48c2-8ebc-3f3a638c9f48",
    "service_name" : "service-3c02",
    "auth_type" : "APP",
    "api_remark" : "test"
  }
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        OK  | 
     
| 
        401  | 
      
        Unauthorized  | 
     
| 
        403  | 
      
        Forbidden  | 
     
| 
        404  | 
      
        Not Found  | 
     
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.