Success and error codes for RESTful APIs


 

The RESTful API has endpoints for GET, POST, PUT, and DELETE commands for managing unauthorized data.

The following table describes the type of status codes displayed after running the GET, POST, PUT, and DELETE commands:

Status Code

HTTP Endpoint type

Sample Input / Output

Description

204 - No content

POST

PUT

DELETE

N.A

This indicates that the operation succeeded, but no output was returned.

200 - OK

GET

POST

PUT

Example request
GET /mvcm-api/ccs/servers
Example response
{
  "servers": [
    {
      "id": 1,
      "name": "SISYSA",
      "controllerType": 2,
      "upstreamHost": "<HostName>.example.com",
      "upstreamPort": nnnn,
      "defaultUpstreamUseSsl": false,
      "startupHost": "localhost",
      "startupMode": "manual",
      "startupModeCluster": 1,
      "clientAccessPortEnabled": false,
      "clientAccessPort": nnnn,
      "clientAccessPortSslEnabled": true,
      "clientAccessPortSsl": nnnn,
      "tn3270eAccessEnabled": false,
      "tn3270eAccessPort": nnnn,
      "tn3270eAccessPortSslEnabled": false,
      "tn3270eAccessPortSsl": nnnn,
      "tn3270eRequireClientCerts": false,
      "tn3270eListsessions": false,
      "tn3270eRequirePassword": false,
      "authExtraOptions": "",
      "authSendOptions": false,
      "authenticationProgram": "",
      "authenticationServerHost": "localhost",
      "authenticationServerPort": nnnn,
      "commandAuditCycleDlyOnDow": false,
      "commandAuditCycleMoOnDom": false,
      "commandAuditCycleSize": nnn,
      "commandAuditCycleType": "BYSIZE",
      "commandAuditLogdir": "AuditLogs",
      "commandSuppressionEnabled": false,
      "commandSuppressionFile": "",
      "logHostNames": false,
      "logfileName": "example.log",
      "maxLogFileSize": 524288,
      "requireClientCerts": false,
      "userAuthMethod": 2,
      "userCreated": "bmcadmin",
      "dateCreated": 0,
      "dateUpdated": 0,
      "enableLog": true,
      "commandAuditEnable": false,
      "status": "stopped",
      "additionalInformation": "Not started",

    }
    
  ]
}

This indicates that the operation succeeded, and JSON content is returned as output based on the input request.

401 - Unauthorized 

or

403 - Forbidden

GET

POST

PUT

DELETE

{
    "timestamp": "2023-06-15T06:02:42.759+00:00",
    "status": 403,
    "error": "Forbidden",
    "message": "Access Denied",
    "path": "/mvcm-api/explorer/name/EXP12"
}

This code is displayed when a user is not authorized to access the API.

404 - Record not found

GET

POST

PUT

DELETE

{
    "status": 404,
    "timestamp": "2023-06-15T06:09:16.225+00:00",
    "message": "Cannot find Explorer root node EXP12"
}

This code is displayed when an entity does not exist.

409 - Conflict information

POST

PUT

{
    "status": 409,
    "timestamp": "2023-06-15T06:14:53.586+00:00",
    "message": "Explorer with name 'EXP1' already exist. Please try with another name."
}

This code is displayed when there is a conflict while adding or updating an entity.

404 - Resource not found

GET

POST

PUT

DELETE

{
    "timestamp": "2023-06-15T06:42:12.088+00:00",
    "status": 404,
    "error": "Not Found",
    "message": "No message available",
    "path": "/mvcm-api/ccs/servers/sad/3434"
}

This code is displayed when an endpoint cannot be found or there is a missing application resource.

500 - Internal error

GET

POST

PUT

DELETE

{
    "timestamp": "2023-06-15T06:24:59.239+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "message": "The request was rejected because the URL contained a potentially malicious String \"%25\"",
    "path": "/mvcm-api/ccs/resources/command-suppression-files/gtest_%23%24%40%26%5E%25%25%24%24!))(()).xml"
}

This code indicates that there is an application error processing the request. This should be reported to support.

400 - Bad request

GET

POST

PUT

DELETE

{
    "status": 400,
    "timestamp": "2023-06-15T06:39:19.687+00:00",
    "message": "Invalid server name. A server name should contain only letters, numbers, underscore and hyphen."
}

This code is displayed when there is an incorrect request for data.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Ops Console Management, BMC AMI Ops Console Automation, and BMC AMI Ops SecureHMC 4.1