Update an API

You can use the HTTP method PUT to update a IBM® z/OS® Connect API.

zosConnect-2.0 Applies to zosConnect-2.0.

Note:
By default, an API will have the status started. However, it can be set to a specific initial status by appending a query string to the URI with a status. For example,

/zosConnect/apis/{apiName}?status=stopped

HTTP method
PUT
URI
/zosConnect/apis/{apiName}
Description
Updates the named API in IBM z/OS Connect using the new API archive file.
Note:
  1. The API needs to be stopped before updating.
  2. The package being updated needs to be for the same API.
Security
Users with Admin or Operations authority can update an API, users with Invoke or Reader authority cannot. For more information about user authorization, see Overview of IBM z/OS Connect security.
Request body
The API archive file file. The content type for the request is application/zip.
Response body
This function returns the Location header pointing to protocol://server:port/basePath
{
  "name": "{name}",
  "version": "{version}",
  "description": "{API description}",
  "status": "Started|Stopped",
  "apiUrl": "http(s)://{host}:{port}/{basePath}"
  "documentation": {
    "swagger":"http(s)://{host}:{port}/{basePath}/api-docs"
  }
where:
  • apiUrl is the URL you use to invoke the API.
  • swagger contains the URL where the Swagger document for the API can be obtained. For more details see Documenting your API using Swagger
Example response body
{
  "name": "HospitalAPI",
  "version": "1.0.0",
  "description": "API for Hospital app",
  "status": "Started",
  "apiUrl": "http://localhost:9080/hospital",
  "documentation": {
    "swagger":"http://localhost:9080/hospital/api-docs"
  }
}
Errors
The following errors can occur:
400 Bad request
Invalid or missing API archive file

409 Conflict
A z/OS Connect API must be stopped before it can be updated.

415 Unsupported Media Type
Content-Type is not application/zip:

500 Internal Server Error
Server issue, might require administrator intervention.

503 Service Unavailable 
A z/OS Connect API must complete all outstanding requests before it can 
     be updated.