REST adapter request and response for the DELETE action
The DELETE action requests the server to delete the resource identified by the request URL.
When you use a context item as an input for an adapter request, you must enclose the adapter request in the <request-data> elements. However, when you create a static request, <request-data> is not required and the adapter request starts with the <restadapterrequest> element.
Adapter requests for the REST adapter are in the JSON format. You specify the adapter name, header, and other parameters, which are converted to a JSON format. By default, the adapter response is in a JSON format.
The following figure describes the elements of an REST adapter request with a Delete action.
Element | Description | Required |
---|---|---|
<adapter name> | Specifies the name of the adapter Default name of the adapter is RESTAdapter | No |
<url> | Specifies the target server URL | Yes |
<headers> | Specifies the header details for the adapter request in a JSON format
Sample header details { "headers" : { "headerName" : "headerValue", "authorization" : { "type" : "basic", "user-name" : "myUser", "password" : "myPassword" } } } For more information, see Specifying header fields for the REST adapter. | No |
<body> | Specifies the data to be posted to the target URL The <body> element accepts JSON format.
Sample format for specifying a <body> in the adapter request
{ "body": { --- any json --- } } Sample format for specifying <body> for a multi-part data request
{ "body": { "entry": [ { "key":"", "value":"", "content-type":""}, {"key":"", "value":"", "content-type":""} ] } } | Yes |
<return-data-format> | Indicates the data type for the adapter response. The adapter returns data only in the JSON format. | No |
<use-ssl-certificate> | Determines whether to establish a secure connection | No |
<allow-unsigned-certificate> | Specifies whether to allow unsigned certificates from trusted zones | No |
<install-certificate> | Determines whether to install certificates | No |
<passphrase> | Specifies the Java Standard Trust Keystore passphrase Warning
Verify the cacerts passphrase using the following command in UNIX or Linux: | No |
<character-set> | Specifies the supporting CharSet Valid values for supported languages:
| No |
<signature-properties> | Contains the elements that specify information about the public key (X.509 certificate) and the private key that are used for the digital signature
| No |
<private-key-file> | Specifies the file containing the private key that is used to sign the HTTP request
| Conditional; required when<signature-properties mode="key-files"> |
<certificate-file> | Specifies the file containing the public key (X509 Certificate)
| Conditional; required when<signature-properties mode="key-files"> |
<private-key-data> | Contains an XML file specifying the private key in an Base64-encoded PEM format | Conditional; required when<signature-properties mode="key-data"> |
<certificate-data> | Contains an XML file specifying the public key (X509 Certificate) in an Base64-encoded PEM format | Conditional; required when<signature-properties mode="key-data"> |
<keystore-file> | Specifies the path to the JKS that contains the client certificate | Conditional; required when<signature-properties mode="keystore"> |
<key-password> | Specifies the password of the key contained in the JKS | No |
<keystore-password> | Specifies the password to the JKS | Conditional; required when<signature-properties mode="keystore"> |
<client alias> | Specifies the name of the alias in the JKS that identifies the Public Key Certificate (PKC) that the web server uses to authenticate the client | Conditional; required when<signature-properties mode="keystore"> |
<enable-redirects> | Specifies whether the adapter should redirect a URL request to the changed URL location | No |
<download-attachment> | Specifies whether the adapter should display the content of the attached file in the adapter response or save the content in a file | No |
<download-directory> | Specifies the full path where the attached file must be downloaded | No |
<request-timeout> | Specifies the time (in seconds) to wait when establishing a connection | No |
<ignore-line-break-in-response> | Specifies whether to ignore the line breaks while generating the adapter response If true, the line break markups are ignored and the response is returned as a single line. If false, the line break markers (if specified in the adapter response) are retained. Valid values: true (default), false | No |
The following figure shows the sample XML request for the DELETE action for an HTTP target.
XML request for the DELETE action for an HTTP target
<target-adapter>rest-actor</target-adapter>
<peer-location>
<location>this</location>
</peer-location>
<request-action>delete</request-action>
<request-data>
<rest-adapter-request>
{"url":"http://10.128.249.27:8080/httpclientoperations/HttpClientServlet"}
<body>{"Delete Request":"ReturnSuccess"</body>
</rest-adapter-request>
</request-data>
</adapter-request>
The following figure shows the adapter response for the DELETE action for an HTTP target.
Adapter response for the DELETE action for an HTTP target
"rest-adapter-response": {
"metadata": {
"status": "success"
},
"status-line": {
"code": "200",
"reason": "OK"
},
"header-lines": {
"Server": "Apache-Coyote/1.1",
"Content-Type": "text/plain;charset=ISO-8859-1",
"Content-Length": "367",
"Date": "Fri, 09 Jun 2017 10:18:38 GMT"
},
"message-body": "<Html><Title>Testing Application for HTTP Adapter<\/Title><Head><\/Head><Title>Testing Application for HTTP Adapter<\/Title><Head><\/Head><Body>Hi, I am inside the doDelete() Method of the EchoServlet, <br><br><br><br> <br><br> Query String : null<br><br><BR><BR> XML Text : <Center> <\/Center><\/Body><\/Html>"
}
}
The following figure shows a sample adapter request for the DELETE action for an HTTPS target.
Sample adapter request for the DELETE action for an HTTPS target
<target-adapter>rest-actor</target-adapter>
<peer-location>
<location>this</location>
</peer-location>
<request-action>delete</request-action>
<request-data>
<rest-adapter-request>{"url":"https://confluence.bmc.com/rest/api/content/270677836/label?name=testlabel","use-ssl-certificate":"true","allow-unsigned-certificate":"true","headers" :{ "Authorization":"Basic amppbnRhOlByZWV0eTEy"}}</rest-adapter-request>
</request-data>
</adapter-request>
The following figure shows the adapter response for an HTTPS target
Adapter response for an HTTPS target
"rest-adapter-response": {
"metadata": {
"status": "success"
},
"status-line": {
"code": "204",
"reason": "No Content"
},
"header-lines": {
"Date": "Fri, 09 Jun 2017 08:35:09 GMT",
"Server": "Apache-Coyote/1.1",
"X-ASEN": "SEN-211201",
"X-Seraph-LoginReason": "OK",
"X-AUSERNAME": "jjinta",
"Content-Encoding": [],
"Vary": [],
"Cache-Control": "no-cache, must-revalidate",
"Expires": "Thu, 01 Jan 1970 00:00:00 GMT",
"X-Content-Type-Options": "nosniff",
"Content-Type": "application/json",
"Set-Cookie": "JSESSIONID=455CE6C332BAD968DE466120E1DEAB89; Path=/; HttpOnly",
"Content-Length": "0",
"Keep-Alive": "timeout=5, max=100",
"Connection": "Keep-Alive"
},
"message-body": []
}
}
The following figure shows a sample adapter request when the <install-certificate> is true.
Sample adapter request when the <install-certificate> is true
<target-adapter>rest-actor</target-adapter>
<peer-location>
<location>this</location>
</peer-location>
<request-action>delete</request-action>
<request-data>
<rest-adapter-request>{"url":"https://confluence.bmc.com/rest/api/content/270677836/label?name=testlabel","use-ssl-certificate":"true","allow-unsigned-certificate":"false","install-certificate":"true","headers" :{ "Authorization":"Basic amppbnRhOlByZWV0eTEy"}}</rest-adapter-request>
</request-data>
</adapter-request>
The following figure shows the adapter response when the <install-certificate> is true.
Adapter response when the <install-certificate> is true
"rest-adapter-response": {
"metadata": {
"status": "success"
},
"status-line": {
"code": "204",
"reason": "No Content"
},
"header-lines": {
"Date": "Fri, 09 Jun 2017 08:35:09 GMT",
"Server": "Apache-Coyote/1.1",
"X-ASEN": "SEN-211201",
"X-Seraph-LoginReason": "OK",
"X-AUSERNAME": "jjinta",
"Content-Encoding": [],
"Vary": [],
"Cache-Control": "no-cache, must-revalidate",
"Expires": "Thu, 01 Jan 1970 00:00:00 GMT",
"X-Content-Type-Options": "nosniff",
"Content-Type": "application/json",
"Set-Cookie": "JSESSIONID=455CE6C332BAD968DE466120E1DEAB89; Path=/; HttpOnly",
"Content-Length": "0",
"Keep-Alive": "timeout=5, max=100",
"Connection": "Keep-Alive"
},
"message-body": []
}
}