HttpRequest
Makes an HTTP Request to a URI/URL
- Stored Procedure
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
EXEC SQLHTTP.net.HttpRequest @HttpSessionID, @URL, [@Method], [@Body], [@IsBodyPathToFile], [@Response OUTPUT], [@StatusCode OUTPUT], [@StatusDescription OUTPUT], [@ContentType], [@Accept], [@AcceptEncoding], [@AcceptLanguage], [@AllowAutoRedirect], [@Connection], [@KeepAlive], [@AllowWriteStreamBuffering], [@Timeout], [@ReadWriteTimeout], [@Referer], [@Expect], [@MaximumAutomaticRedirections], [@SendChunked], [@TransferEncoding], [@MediaType], [@ProxyHost], [@ProxyPort], [@IgnoreCertErrors], [@HttpQueueTimeout], [@HttpQueueAgent], [@HttpQueuePriority], [@HttpQueueID OUTPUT], [@DebugMode]
Name | Type | Description |
---|---|---|
@HttpSessionID | uniqueidentifier | Required. This value is obtained via the HttpSession stored procedure/td> |
@URL | nvarchar(4000) | Required. Web address starting with http:// or https:// |
@Method | varchar(10) | Optional. Protocol method to use in this request. Default: GET |
@Body | nvarchar(MAX) | Optional. Data to send with a POST Method |
@IsBodyPathToFile | bit | Optional. Boolean value indicating whether the @Body parameter contains a path to a file. If true, the @Body parameter will be replaced with the content of the file. This feature is useful when submitting a file to a website. See the stored procedure on this page for an example. Default: 0 (false) |
@Response | nvarchar(MAX) | Optional. Output Parameter. Data received from the web request. Binary data is returned as a Base64 string |
@StatusCode | int | Optional. Output Parameter. Numeric status of the HTTP response |
@StatusDescription | nvarchar(MAX) | Optional. Output Parameter. Status Description returned with the response |
@ContentType | nvarchar(4000) | Optional. Value of the Content-type HTTP header |
@Accept | nvarchar(4000) | Optional. Value of the Accept HTTP header |
@AcceptEncoding | nvarchar(4000) | Optional. Value of the Accept-Encoding HTTP header |
@AcceptLanguage | nvarchar(4000) | Optional. Value of the Accept-Language HTTP header |
@AllowAutoRedirect | bit | Optional. Indicates whether the request should follow redirection responses. Default: 0 (false) |
@Connection | nvarchar(4000) | Optional. Value of the Connection HTTP header |
@KeepAlive | bit | Optional. Indicates whether to make a persistent connection to the Internet resource. Default: 1 (true)
|
@AllowWriteStreamBuffering | bit | Optional. Indicates whether to buffer the data sent. Default: 1 (true) |
@Timeout | int | Optional. Time in milliseconds for the server to respond to a request. Default: 100,000 |
@ReadWriteTimeout | int | Optional. Time in milliseconds to wait for the server to transmit all the data. Default: 300,000 |
@Referer | nvarchar(4000) | Optional. Value of the Referer HTTP header |
@Expect | nvarchar(4000) | Optional. Value of the Expect HTTP header |
@MaximumAutomaticRedirections | int | Optional. The maximum number of redirects that the request follows. Default: 50 |
@SendChunked | bit | Optional. Indicates whether to send data in segments to the Internet resource. Default: 0 (false) |
@TransferEncoding | nvarchar(4000) | Optional. Value of the Transfer-encoding HTTP header |
@MediaType | nvarchar(4000) | Optional. Media Type of the request |
@ProxyHost | nvarchar(4000) | Optional. Web address of an HTTP Proxy |
@ProxyPort | int | Optional. Port value to use with @ProxyHost. Default: 80 |
@IgnoreCertErrors | bit | Optional. Indicates whether to ignore certificate errors. Default: 0 (false) |
@HttpQueueTimeout | int | Optional. Time in milliseconds for the SQLHTTP Agent to complete processing a request. Setting this value directs SQLHTTP to use the SQLHTTP Agent to process this HTTP request.
Values greater than 0 instruct the stored procedure to wait until the SQLHTTP Agent completes processing the HTTP request or the timeout is reached. A Value of 0 exits the stored procedure allowing the SQLHTTP Agent to proceed asynchronously. Default: NULL (processing will be completely performed in the SQL Server process) |
@HttpQueueAgent | nvarchar(100) | Optional. Name or IP address of a machine running the SQLHTTP Agent that should be assigned the request. Setting this value directs SQLHTTP to use the SQLHTTP Agent to process this HTTP request.
Default: NULL |
@HttpQueuePriority | tinyint | Optional. A value between 0 and 9 that the SQLHTTP Agent uses to prioritize pending requests. 0 = Lowest Priority. 9 = Highest Priority.
Default: 5 |
@HttpQueueID | int | Optional. Output Parameter. The unique ID of the SQLHTTP Agent queue processing this HTTP request, where applicable |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
DECLARE @URL nvarchar(4000) DECLARE @HttpSessionID uniqueidentifier DECLARE @Response varchar(MAX) DECLARE @StatusCode int DECLARE @StatusDescription nvarchar(MAX) SET @URL = 'enter URL here' EXEC SQLHTTP.net.HttpSession @HttpSessionID OUTPUT EXEC SQLHTTP.net.HttpRequest @HttpSessionID, @URL = @URL, @Response = @Response OUTPUT, @StatusCode = @StatusCode OUTPUT, @StatusDescription = @StatusDescription OUTPUT |
- AuthListener
- AuthParam
- AuthParamRemove
- AuthParamsClear
- AuthParamSet
- BasicAuthHeader
- FormDataBuilder
- HttpQueueActivity
- HttpRequest
- HttpSession
- IsUrlValid
- OAuthHeader
- QueryStringBuilder
- RaiseHttpError
- RequestHeaderRemove
- RequestHeaders
- RequestHeaderSet
- RequestPartAdd
- ResponseHeaders
- UrlBuilder
- UrlProperty