Importing APIs
Function
This API is used to import APIs. The content of the imported file must comply with the Swagger standard. For details about the customized extended fields, see "Appendix: Swagger Extension Definition of Frontend APIs" in the ROMA Connect User Guide.
URI
POST /v2/{project_id}/apic/instances/{instance_id}/openapi/import
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Appendix > Obtaining a Project ID in the ROMA Connect API Reference. |
instance_id |
Yes |
String |
Instance ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
is_create_group |
No |
Boolean |
Whether to create a new group. Default: true |
group_id |
No |
String |
API group ID. This parameter is mandatory when is_create_group is set to false. |
app_id |
No |
String |
Application ID. This parameter is mandatory when is_create_group is set to false and the integration application group is used. |
extend_mode |
No |
String |
Import mode of extended information.
Default: merge |
simple_mode |
No |
Boolean |
Whether to enable fast import. Default: false |
mock_mode |
No |
Boolean |
Whether to enable the Mock backend. Default: false |
api_mode |
No |
String |
Import mode.
Default: merge |
file_name |
Yes |
File |
Request body in JSON or YAML format for importing APIs |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
success |
Array of Success objects |
Import success information. |
failure |
Array of Failure objects |
Import failure information. |
swagger |
Swagger object |
Swagger file import result. This parameter is currently not supported. |
group_id |
String |
API group ID. |
ignore |
Array of Ignore objects |
APIs that are not imported. |
Parameter |
Type |
Description |
---|---|---|
path |
String |
API request path. |
method |
String |
API request method. |
action |
String |
Import type.
|
id |
String |
ID of an imported API. |
Parameter |
Type |
Description |
---|---|---|
path |
String |
API request path. |
error_msg |
String |
Error message displayed for an import failure. |
method |
String |
API request method. |
error_code |
String |
Error code displayed for an import failure. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Swagger file No. |
result |
String |
Import result description. |
Parameter |
Type |
Description |
---|---|---|
method |
String |
API request method. |
path |
String |
API request path. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Requests
-
Import the JSON file to the new API group.
------WebKitFormBoundaryFwfebf82ScagmrUe Content-Disposition: form-data; name="file_name"; filename="apis.json" Content-Type: application/json ------WebKitFormBoundaryFwfebf82ScagmrUe Content-Disposition: form-data; name="is_create_group" true ------WebKitFormBoundaryFwfebf82ScagmrUe--
-
Import the YAML file to the new API group.
------WebKitFormBoundaryFwfebf82ScagmrUe Content-Disposition: form-data; name="file_name"; filename="apis.yaml" Content-Type: application/x-yaml ------WebKitFormBoundaryFwfebf82ScagmrUe Content-Disposition: form-data; name="is_create_group" true ------WebKitFormBoundaryFwfebf82ScagmrUe--
Example Responses
Status code: 200
OK
{ "group_id" : "d9ce8c9eede54b3f841ec324fe0bfdc2", "failure" : [ { "path" : "/test/demo", "error_msg" : "The API already exists, An API with the same combination of the method, path, and x-apigateway-match-mode fields already exists. API name: API_demo", "method" : "GET", "error_code" : "APIG.3301" } ], "success" : [ { "path" : "/test", "method" : "GET", "action" : "create", "id" : "8ae6bcafab6f49d78242bff26ad8a4f0" } ], "swagger" : { "swagger_id" : "412488ba965041f9838a5266a5f8e574", "result" : "Success" } }
Status code: 400
Bad Request
{ "error_code" : "APIG.3201", "error_msg" : "The API group name already exists" }
Status code: 401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" }
Status code: 404
Not Found
{ "error_code" : "APIG.3001", "error_msg" : "API group not found" }
Status code: 500
Internal Server Error
{ "error_code" : "APIG.9999", "error_msg" : "System error" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server 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