HTTP adapter request and response for a POST action
The POST operation sends data to a specified URL. The adapter request with a POST action uses the following formats:
- Single element
- Parent and child
- Entry, key-value
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 <httpadapterrequest>
element.
You can also upload multiple files and data by using the multipart/form-data specified in the <Content-Type>
element in the the HTTP request header.
The following table describes the elements of an HTTP adapter request with a POST action.
Use the adapter request XML when you create a custom process by using the Call Adapter activity in TrueSight Orchestration Development Studio.
Elements of an HTTP adapter request with a POST action
Element | Description | Required |
---|---|---|
<adapter-name> | Specifies the name of the adapter to be used for this request Default value: HTTPAdapter | No |
<action> | Specifies the URL of the content to be sent | Yes |
| Specifies whether to establish a secure connection | No |
| Specifies whether to install certificates | No |
| Specifies whether to allow unsigned certificates from trusted zones | No |
| Specifies the Java Standard Trust Key Store passphrase Warning
Verify the cacerts passphrase using the following command in UNIX or Linux: | No |
| Indicates the data type for the adapter response | No |
| Specifies the user name to be used for basic authentication | No |
| Specifies the password corresponding to the user name provided for basic authentication | No |
| Specifies an XML document that includes HTTP connection properties, which contain the
Example
Example for multiple file upload
Note: The user name and password properties are not set in the request header and are case sensitive. | Conditional; required if you want to send multiple files in the request. Specify |
| Specifies the user name required for basic or NTLM authentication specified in | No |
| Specifies the password corresponding to the user name specified in | No |
| Contains the data to be posted
Note: When you specify the NEW IN 20.19.01 For a multipart/form-data request, you can specify the content type as application/json in the request body. For a sample adapter request, see Sample adapter request for a multipart/form-data request when the content-type is application/json. | Yes |
| Specifies the supporting CharSet | No |
| 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 |
| Specifies the file name and local path of the file to be sent to the URL C:\\adapters\\testfile.txt
| No |
| Specifies the content type of the file to be uploaded For text: text\plain For files: application/octet-stream (Required for using multipart/form-data for sending multiple files over the adapter request) | Conditional; used if the adapter request contains a |
| Indicates whether to use NTLM authentication for the target server for the specified user credentials | No |
| Specifies the file containing the private key that is used to sign the HTTP request
| Conditional; required when |
| Specifies the file containing the public key (X509 Certificate)
| Conditional; required when |
| Contains an XML file specifying the private key in an Base64-encoded PEM format | Conditional; required when |
| Contains an XML file specifying the public key (X509 Certificate) in an Base64-encoded PEM format | Conditional; required when |
| Specifies the path to the JKS that contains the client certificate | Conditional; required when |
| Specifies the password of the key contained in the JKS | No |
| Specifies the password to the JKS | Conditional; required when |
| 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 |
| Specifies whether the adapter should treat the input data in the request and the data received in the adapter response as a JavaScript Object Notation (JSON) string
| No |
| Specifies whether the adapter redirects a URL request to the changed URL location | No |
<include-expect-header-in-request> | Specifies whether to include the expect header in the adapter request Note: By default, the expect header is included in the request. Valid values: true (default), false | No |
<request-timeout> | Specifies the time (in seconds) to wait when establishing a connection Default value: 10 seconds. | 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 |
Recommendation
The HTTP adapter supports both <httpAdapterRequest>
and <http-adapter-request>
tags for an adapter request; however, only the <httpAdapterResponse>
tag is supported for an adapter response.
BMC recommends that you use the <httpAdapterRequest>
root tag for the adapter request.
The HTTP adapter generates a response to the HTTP request (URL) defined in the adapter request. The response format depends on <Content-Type>
of the HTTP server response.
Elements of an HTTP adapter response to a request with a POST action
Element | Description |
---|---|
| Contains the |
| Specifies the status of the adapter request |
| Contains the elements in the |
| Specifies the numeric status code for the response |
| Specifies the reason associated with the code |
| Contains the elements in the |
| Specifies the specific field name and value returned from the adapter request |
| Contains the message body of the HTTP response in CDATA format |
The following figure shows a sample adapter request for a multipart/form-data request and when the file content type is application/json.
<http-adapter-request>
<http-connection-properties>
<Content-Type>multipart/form-data</Content-Type>
<Authorization>AR-JWT eyJhbGciOiJIUzI1NiJ9.eyJzdWI..............</Authorization>
</http-connection-properties>
<action>http://clm-abc-123456:8008/api/arsys/v1/entry/sample_attach</action>
<data>
<entry>
<key>entry</key>
<value><![CDATA[{
"values" :
{"Submitter__c" : "Allen", "Short Description__c" : "File", "Attachment__c" : "Task.txt"}
}]]></value>
<content-type>application/json</content-type>
</entry>
<entry>
<key>attach-Attachment__c</key>
<value>C:\Shared\Task.txt</value>
<content-type>application/octet-stream</content-type>
</entry>
</data>
</http-adapter-request>
The following figure shows a sample adapter request and the adapter response for uploading an attachment to JIRA (file only).
<http-adapter-request>
<http-connection-properties>
<Content-Type>multipart/form-data</Content-Type>
<Authorization>Basic amFpc2luZ2g6SGluJDE5ODQ=</Authorization>
<X-Atlassian-Token>nocheck</X-Atlassian-Token>
</http-connection-properties>
<action>https://jira.bmc.com/rest/api/2/issue/DRAOC-59805/attachments</action>
<data>
<entry>
<key>file</key>
<value>C:\jira3.txt</value>
<content-type>application/octet-stream</content-type>
</entry>
</data>
</http-adapter-request>
The following figure shows the adapter response for uploading an attachment in JIRA (file only).
<httpAdapterResponse>
<metadata>
<status>success</status>
</metadata>
<status-line>
<code>200</code>
<reason>OK</reason>
</status-line>
<header-lines>
<Date>Mon, 20 Mar 2017 09:20:42 GMT</Date>
<X-AREQUESTID>260x329136x2</X-AREQUESTID>
<X-ANODEID>phx-jiraprd-03</X-ANODEID>
<X-ASEN>SEN-5981199</X-ASEN>
<Set-Cookie>JSESSIONID=66843D6E361824E0F92A06FCC7E63497; Path=/; Secure; HttpOnly</Set-Cookie>
<X-Seraph-LoginReason>OK</X-Seraph-LoginReason>
<Set-Cookie>atlassian.xsrf.token=BXV8-9FAB-2I0V-4AN7|df08b8af9b9b90342519e22bcdfa9d67b79d7a8b|lin; Path=/; Secure</Set-Cookie>
<X-ASESSIONID>9oufav</X-ASESSIONID>
<X-AUSERNAME>jaisingh</X-AUSERNAME>
<Cache-Control>no-cache, no-store, no-transform</Cache-Control>
<X-Content-Type-Options>nosniff</X-Content-Type-Options>
<Content-Type>application/json;charset=UTF-8</Content-Type>
<Keep-Alive>timeout=5, max=100</Keep-Alive>
<Connection>Keep-Alive</Connection>
<Transfer-Encoding>chunked</Transfer-Encoding>
</header-lines>
<message-body>[{"self":"https://jira.bmc.com/rest/api/2/attachment/137335","id":"137335",
"filename":"jira3.txt","author":{"self":"https://jira.bmc.com/rest/api/2/user?username=jaisingh",
"name":"jaisingh","key":"jaisingh","emailAddress":"Jaivardhan_Singh_CW@bmc.com",
"avatarUrls":{"48x48":"https://jira.bmc.com/secure/useravatar?avatarId=10122",
"24x24":"https://jira.bmc.com/secure/useravatar?size=small&avatarId=10122",
"16x16":"https://jira.bmc.com/secure/useravatar?size=xsmall&avatarId=10122",
"32x32":"https://jira.bmc.com/secure/useravatar?size=medium&avatarId=10122"},"displayName":"Singh, Jaivardhan","active":true,"timeZone":"America/Chicago"},"created":"2017-03-20T04:20:42.950-0500","size":11,"mimeType":"text/plain","content":"https://jira.bmc.com/secure/attachment/137335/jira3.txt"}]</message-body>
</httpAdapterResponse>
Note
<script>
and <style>
elements are deleted from the HTTP response for XHTML data format.
Note
The JSON string is processed only if it is contained in the <body>
, <message-body>
, or <non-xml-data-response>
elements.
Comments
Log in or register to comment.