REST adapter request and response for the PATCH action
The PATCH action for the REST adapter sends updates to the specified 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 <rest-adapter-request> 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 Patch action.
Elements of an REST adapter request with a Patch 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 to which you want to send data | Yes |
<headers> | Specifies the header details for the adapter request, in a JSON format Sample header { "headers": { "authorization": "New Authentication Token" "Content-Type":"application/json" } } 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. JSON sample for specifying the <body> element { --- formatted json for patch --- } Sample format for specifying <body> for a multi-part data request { "op": "replace", "path": "/name", "value": "John" } | No |
<return-data-format> | Indicates the data type for the adapter response. | 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. If true, the security certificates are installed automatically (a common practice). If false, the user must manually export the security certificate from the specified target server and manually import it to the cacerts file on a local peer. | No |
<passphrase> | Specifies the Java Standard Trust Keystore passphrase 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 |
<secure-protocols> | Specifies the SSL/TLS protocols for establishing a network connection with a target server You can specify a single string value like SSLv3 or TLSv1 or a list of protocols separated by commas. Example: TLSv1,TLSv1.1,TLSv1.2 | No |
The following figure shows the sample XML request for the PATCH action.
<target-adapter>rest-actor</target-adapter>
<peer-location>
<location>this</location>
</peer-location>
<request-action>patch</request-action>
<request-data>
<rest-adapter-request>
<headers><![CDATA[
{
"url":"http://Endpoint-Url",
"return-data-format":"XML",
"headers": { "Authorization": "New Authentication Token",
"Content-Type":"application/json" } }
]]></headers>
<body><![CDATA[[
{
"op": "replace",
"path": "/address",
"value": "1.1.1.1"
},
{
"op": "replace",
"path": "/name",
"value": "John"
}
]
]]></body>
</rest-adapter-request>
</request-data>
</adapter-request>
The following figure shows the adapter response for the PATCH action.
"rest-adapter-response":{
"metadata":{
"status":"success"
},
"status-line":{
"code":"200",
"reason":"OK"
},
"header-lines":{
"Cache-Control":"no-cache, no-store, must-revalidate",
"Pragma":"no-cache",
"Content-Type":"application/json; charset=utf-8",
"Expires":"-1",
"Server":"Microsoft-IIS/8.5",
"Set-Cookie":[
"CAXXXX=; path=/PasswordVault/; HttpOnly",
],
"api-supported-versions":"10.8",
"X-UA-Compatible":"IE=EmulateIE8",
"X-XSS-Protection":"1; mode=block",
"X-Content-Type-Options":"nosniff",
"X-FRAME-Options":"SAMEORIGIN",
"Access-Control-Expose-Headers":"Warning",
"Date":"Thu, 20 Aug 2020 09:17:14 GMT",
"Content-Length":"331"
},
"message-body":{
"id":"37_x",
"name":"John",
"address":"1.2.3.4",
"userName":"vaultUserAccount",
"platformId":"WinServerLocal",
"safeName":"TestSafe",
"secretType":"password",
"platformAccountProperties":{
"LogonDomain":"1.2.5.8"
},
"secretManagement":{
"automaticManagementEnabled":true,
"lastModifiedTime":1573610221
},
"createdTime":1573610221
}
}
}