{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":825,"path":"api-reference/server-api-reference/HttpRequestDataAPI.md","title":"HttpRequestData - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# HttpRequestData- Scoped\n\nThe HttpRequestData API provides methods to build and manipulate a REST request before applying a signature and sending it to an endpoint.\n\nGenerate outbound signing requests using these APIs in the following order:\n\n1.  HttpRequestData: Build the API request.\n2.  AuthCredential: Create a credential object or update an existing one. Use the credential to sign the request through the RequestAuthAPI class.\n3.  RequestAuthAPI: Sign the request and return an HttpRequestAuthedData object.\n4.  HttpRequestAuthedData: Get information about the signed request.\n5.  GlideHTTPRequest: Send the signed request.\n\nBefore using these APIs, you must [configure an authentication algorithm](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-security/configure-authentication-algorithm.md) to sign the request and associate it with the credential used to authenticate the request.\n\nUse this API in scoped scripts with the `sn_auth` namespace identifier. You can instantiate this class using the constructor, or you can return an HttpRequestData object from the getHttpRequestData\\(\\) method in the RequestAuthAPI class.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## HttpRequestData - HttpRequestData\\(\\)\n\nInstantiates an HttpRequestData object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n```\nvar httpRequestData = new sn_auth.HttpRequestData();\n```\n\n## HttpRequestData - addHeader\\(String key String value\\)\n\nAdds a header to the HttpRequestData object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|key|String|Name of the HTTP header.|\n|value|String|Value of the HTTP Header.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\nThis example creates a REST request payload.\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod(\"PUT\");\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl', 'public-read' );\n```\n\n## HttpRequestData - addQueryParam\\(String key, String value\\)\n\nAdds a query parameter to the HttpRequestData object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|key|String|Name of the query parameter.|\n|value|String|Value of the query parameter.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addQueryParam('api_version', 'v2 );\n​\n```\n\n## HttpRequestData - deleteHeader\\(String key\\)\n\nRemoves a header from the HttpRequestData object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|key|String|Name of the HTTP header to remove.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.deleteHeader('x-amz-acl');\n```\n\n## HttpRequestData - getConnectionAliasID\\(\\)\n\nReturns the sys\\_id of the Connection &amp; Credential alias associated with the Integration Hub REST step.\n\nYou can pass the sys\\_id to the ConnectionInfoProvider API to retrieve information about the connection.\n\n**Note:** You can only use this method in an Integration Hub REST step. For more information, see [REST step](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/rest-request-action-designer.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Sys\\_id of the alias record from the Connection &amp; Credential Aliases \\[sys\\_alias\\] table associated with the request.|\n\n```\nvar httpRequestData = new sn_auth.HttpRequestData();\nvar id = httpRequestData.getConnectionAliasID();\n \nvar credential = new sn_cc.ConnectionInfoProvider().\nvar connectionInfo = credential.getConnectionInfo(id);\n```\n\n## HttpRequestData - getConnectionExtendedAttribute\\(String name\\)\n\nReturns the value of a connection attribute associated with the Connection &amp; Credential alias associated with Integration Hub REST step.\n\n**Note:** You can only use this method in an Integration Hub REST step. For more information, see [REST step](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/rest-request-action-designer.md).\n\nFor more information about connection attributes, see [Create connection attributes for Integration Hub](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-security/create-connection-attributes.md).\n\n|Name|Type|Description|\n|----|----|-----------|\n|name|String|Name of the connection attribute.|\n\n|Type|Description|\n|----|-----------|\n|String|Value of the connection attribute.|\n\nThis example returns the value of a connection attribute set on the Connection &amp; Credential alias associated with the REST step.\n\n```\nvar httpRequestData = new sn_auth.HttpRequestData();​\ngs.info(\"API Version is: \" + httpRequestData.getConnectionExtendedAttribute('api_version'));\n```\n\n## HttpRequestData - getContent\\(\\)\n\nReturns the content of the request in the HttpRequestData object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Content of the request.|\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl' , 'public-read' );\nvar ct = httpRequestData.getContent();\n```\n\nOutput:\n\n```\nAction=SendMessage&MessageBody=This is a test message\n```\n\n## HttpRequestData - getDate\\(\\)\n\nReturns the date when the request was signed.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_kf4_zsx_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nThe difference between January 1, 1970 UTC and when the request was signed.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\n\ngs.info( \"Date: \" + httpRequestData.getDate());\n```\n\nOutput:\n\n```\nDate: 1349333576093\n```\n\n## HttpRequestData - getDirective\\(\\)\n\nReturns whether the signature is applied to the request in the header or as a query parameter.\n\nBy default, the system applies the signature to the header. You can apply the signature as a query parameter using the setDirective\\(\\) API.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_sjy_btx_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nString\n\n</td><td>\n\nWhether the signature is applied to the header or as a query parameter. Values include:\n\n -   HEADER: The signature is applied to the request header.\n-   QUERY: The signature is applied as a query parameter.\n\n</td></tr></tbody>\n</table>```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\n\ngs.info( \"Signature applied to: \" + httpRequestData.getDirective() );\n```\n\nOutput:\n\n```\nSignature applied to: HEADER\n```\n\n## HttpRequestData - getEndpoint\\(\\)\n\nReturns the endpoint set for the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Endpoint set for the request.|\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\nhttpRequestData.setDirective(\"query\");​\n​\ngs.info( \"Endpoint is: \" + httpRequestData.getEndpoint() );\n```\n\nOutput:\n\n```\nEndpoint is: https://s3.amazonaws.com\n```\n\n## HttpRequestData - getExpiry\\(\\)\n\nReturns the time in seconds before the signature expires starting when the request was signed using the generateAuth\\(\\) method in the RequestAuthAPI class.\n\nThe expiration is commonly set by the third-party service you are sending the request to, which overrides any value set by the setExpiry\\(\\) method. For example, if the expiration is set to 900 seconds by the third-party service and you use the setExpiry\\(\\) method to set the expiration to 300 seconds, the getExpiry\\(\\) method returns 900 seconds.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_wr1_ftx_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nTime before the signature expires.Unit: Seconds\n\n</td></tr></tbody>\n</table>```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\nhttpRequestData.setDirective(\"query\");​\nhttpRequestData.setExpiry(300);\n\ngs.info(\"Signature expires in: \" + httpRequestData.getExpiry());\n```\n\nOutput:\n\n```\nSignature expires in: 300\n```\n\n## HttpRequestData - getHeader\\(String key\\)\n\nReturns the value associated with the given HTTP header.\n\n|Name|Type|Description|\n|----|----|-----------|\n|key|String|Name of HTTP header.|\n\n|Type|Description|\n|----|-----------|\n|String|Value of the given HTTP header.|\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl', 'public-read' );\n​\n\ngs.info( \"Header value is: \" + httpRequestData.getHeader('x-amz-acl') );\n```\n\nOutput:\n\n```\nHeader value is: public-read\n```\n\n## HttpRequestData - getHeaderMap\\(\\)\n\nReturns an object containing the headers included in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_thk_3tx_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nKey-value pairs that define all of the headers associated with the request. Each key-value pair includes these parts:\n\n -   Key: String. Name of the header.\n-   Value: String. Value of the header.\n\n</td></tr></tbody>\n</table>```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl', 'public-read' );\nhttpRequestData.addHeader('content-type', 'application/json' );\n\nvar map = httpRequestData.getHeaderMap();\n\nfor(var x in map) {\n    var y = map[x]\n\n    gs.info(x, y);\n}\n```\n\nOutput:\n\n```\n*** Script: x-amz-acl\n*** Script: content-type\n```\n\n## HttpRequestData - getHost\\(\\)\n\nReturns the host used in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Host used in the request.|\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setHost('myHost')\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl' , 'public-read' );\n\ngs.info(\"Host is: \" + httpRequestData.getHost());\n```\n\nOutput:\n\n```\nHost is: myHost\n```\n\n## HttpRequestData - getHttpMethod\\(\\)\n\nReturns the HTTP method used in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|HTTP method used in the request.|\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl', 'public-read' );\n​\n\ngs.info(\"HTTP method is: \" + httpRequestData.getHttpMethod());\n```\n\nOutput:\n\n```\nHTTP method is: PUT\n```\n\n## HttpRequestData - getQueryParam\\(String key\\)\n\nReturns the value of the specified query parameter.\n\n|Name|Type|Description|\n|----|----|-----------|\n|key|String|Name of the query parameter to get the value of.|\n\n|Type|Description|\n|----|-----------|\n|String|Value of the query parameter.|\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addQueryParam('api_version', 'v2' );\n\ngs.info(\"API version is: \" + httpRequestData.getQueryParam('api_version'));\n```\n\nOutput:\n\n```\nAPI version is: v2\n```\n\n## HttpRequestData - getQueryParamMap\\(\\)\n\nReturns an object containing the query parameters included in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_qk3_rtx_sjb\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nObject\n\n</td><td>\n\nKey-value pairs that define the query parameters associated with the request. Each key-value pair includes these parts:\n\n -   Key: String. Name of the query parameter.\n-   Value: String. Value of the query parameter.\n\n</td></tr></tbody>\n</table>```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addQueryParam('api_version', 'v2' );\nhttpRequestData.addQueryParam('limit', '1000' );\nhttpRequestData.addQueryParam('offset', '1' );\n\n\nvar map = httpRequestData.getQueryParamMap();\ngs.info(\"api_version is: \" + map['api_version']);\n```\n\nOutput:\n\n```\napi_version is: v2\n```\n\n## HttpRequestData - getRegion\\(\\)\n\nReturns the region for the request that will be used in signing.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Name of the region.|\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\n\ngs.info(\"Region is: \" + httpRequestData.getRegion());\n```\n\nOutput:\n\n```\nRegion is: us-east-1\n```\n\n## HttpRequestData - getService\\(\\)\n\nReturns the service defined in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Service defined in the request.|\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\n\ngs.info(\"Service is: \" + httpRequestData.getService());\n```\n\nOutput:\n\n```\nService is: s3\n```\n\n## HttpRequestData - setContent\\(String content\\)\n\nDefines the content to send in the request.\n\n**Note:** This method is not supported in script includes or MID server scripts.\n\n|Name|Type|Description|\n|----|----|-----------|\n|content|String|Content to send in the request.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"This is a test message\";\nhttpRequestData.setContent(content);\n```\n\n## HttpRequestData - setDate\\(Number date\\)\n\nDefines the date of the request used for signing.\n\nUse this method only when testing whether the signature is created correctly based on a time stamp. In production, the signing request uses the time that you generated the signature; manually setting this value may cause the signing request to fail.\n\n<table id=\"table_xzg_pcy_sjb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ndate\n\n</td><td>\n\nNumber\n\n</td><td>\n\nThe difference between January 1, 1970 UTC and the date used to sign the request.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');\nhttpRequestData.setDate(1349333576093);\n```\n\n## HttpRequestData - setDirective\\(String directive\\)\n\nDefines whether to apply the signature to the request in a header or as a query parameter.\n\n<table id=\"table_nxn_rcy_sjb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ndirective\n\n</td><td>\n\nString\n\n</td><td>\n\nWhether to apply the signature to the header or as a query parameter. Values include:\n\n -   `query`: Applies signature as a query parameter.\n-   `header`: Applies signature to the request header.\n\n Default: header\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\nhttpRequestData.setDirective(\"query\");​\n```\n\n## HttpRequestData - setEndpoint\\(String endpoint\\)\n\nDefines the endpoint to send the request to.\n\n|Name|Type|Description|\n|----|----|-----------|\n|endpoint|String|Endpoint to send the request to. The endpoint can include query parameters, path, and version.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint=\"https://third-party-endpoint/path-parameters/version\";\n\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\n\n```\n\n## HttpRequestData - setExpiry\\(Number expiry\\)\n\nSets the amount of time before the signature expires starting when the request is signed using the generateAuth\\(\\) method in the RequestAuthAPI class.\n\nThe expiration is commonly set by the third-party service you are sending the request to, which overrides any value set by the setExpiry\\(\\) method. For example, if the expiration is set to 900 seconds by the third-party service and you use the setExpiry\\(\\) method to set the expiration to 300 seconds, the getExpiry\\(\\) method returns 900 seconds.\n\n<table id=\"table_wbj_5cy_sjb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nexpiry\n\n</td><td>\n\nNumber\n\n</td><td>\n\nAmount of time before the signature expires.Unit: Seconds\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";​\nvar httpRequestData = new sn_auth.HttpRequestData();​\nhttpRequestData.setEndpoint(endpoint);​\nhttpRequestData.addQueryParam(\"list-type\", \"2\");​\nhttpRequestData.setService('s3');​\nhttpRequestData.setHttpMethod('get');​\nhttpRequestData.setExpiry(300);​\n```\n\n## HttpRequestData - setHost\\(String host\\)\n\nDefines the host used in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|host|String|Name of the HTTP request host.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https:third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setHost('myHost')\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\nhttpRequestData.addHeader('x-amz-acl', 'public-read' );\n```\n\n## HttpRequestData - setHttpMethod\\(String httpMethod\\)\n\nSets the HTTP method to use in the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|httpMethod|String|HTTP method to use in the request.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\n```\n\n## HttpRequestData - setRegion\\(String region\\)\n\nDefines the region to use for the request in signing.\n\n|Name|Type|Description|\n|----|----|-----------|\n|region|String|The region to use to sign the request. Available values are determined by the third-party API's requirements.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https:third-party-endpoint\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\nhttpRequestData.setRegion('us-east-1');\nhttpRequestData.setHttpMethod('put');\nvar content = \"Action=SendMessage&MessageBody=This is a test message\";\nhttpRequestData.setContent(content);\n```\n\n## HttpRequestData - setService\\(String service\\)\n\nDefines the service for the request.\n\n|Name|Type|Description|\n|----|----|-----------|\n|service|String|The service for the request.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar endpoint= \"https://s3.amazonaws.com\";\nvar httpRequestData = new sn_auth.HttpRequestData();\nhttpRequestData.setEndpoint(endpoint);\nhttpRequestData.setService('s3');\n\n```\n\n"}}