Skip to main content

Class HttpUtil

Namespace: Workspace.XBR.Xperiflow.Utilities.Http

Assembly: Xperiflow.dll

Declaration
public static class HttpUtil

Methods​

ExtractWebResponseAsJsonObject(SessionInfo, ref HttpResponseMessage)​

Extracts the content that exists within a WebResponse as a JObject. Note that there are side effects on this webResp object. See parameter for details.

Declaration
public static JObject? ExtractWebResponseAsJsonObject(SessionInfo si, ref HttpResponseMessage response)
Returns​

Newtonsoft.Json.Linq.JObject

JObject - Note that null will be returned in the event that the WebResponse is null.

Parameters​
TypeNameDescription
OneStream.Shared.Common.SessionInfosi
System.Net.Http.HttpResponseMessageresponseNote that there are side effects on this object. This will extract the response content from the web response.

ExtractWebResponseAsString(SessionInfo, ref HttpResponseMessage)​

Extracts the content that exists within a WebResponse as a String. Note that there are side effects on this webResp object. See parameter for details.

Declaration
public static string ExtractWebResponseAsString(SessionInfo si, ref HttpResponseMessage response)
Returns​

System.String

String - Note that an empty string will be returned in the event that the WebResponse is null.

Parameters​
TypeNameDescription
OneStream.Shared.Common.SessionInfosiSession information.
System.Net.Http.HttpResponseMessageresponseNote that there are side effects on this object. This will extract the response content from the web response.

GetJsonObjectFromJsonString(SessionInfo, string)​

Converts a JSON-formatted string to a JObject.

Declaration
public static JObject? GetJsonObjectFromJsonString(SessionInfo si, string jsonString)
Returns​

Newtonsoft.Json.Linq.JObject

A JObject representation of the JSON string, or null if the string is empty or invalid.

Parameters​
TypeNameDescription
OneStream.Shared.Common.SessionInfosiThe session information.
System.StringjsonStringThe JSON-formatted string to convert.

BuildWebQueryParameterString(SessionInfo, Dictionary<string, object>)​

Declaration
public static string BuildWebQueryParameterString(SessionInfo si, Dictionary<string, object> queryParams)
Returns​

System.String

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.Collections.Generic.Dictionary<System.String,System.Object>queryParams

BuildUri(SessionInfo, Uri, string, object[]?, Dictionary<string, object>?)​

Declaration
public static Uri BuildUri(SessionInfo si, Uri baseUri, string relativeUri, object[]? urlParams = null, Dictionary<string, object>? queryParams = null)
Returns​

System.Uri

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.UribaseUri
System.StringrelativeUri
System.Object[]urlParams
System.Collections.Generic.Dictionary<System.String,System.Object>queryParams

BuildBodyParams(SessionInfo, string, Encoding?, string)​

Declaration
public static StringContent? BuildBodyParams(SessionInfo si, string bodyParams, Encoding? encoding = null, string mediaType = "application/json")
Returns​

System.Net.Http.StringContent

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.StringbodyParams
System.Text.Encodingencoding
System.StringmediaType

BuildBodyParams(SessionInfo, JObject, Encoding?, string)​

Declaration
public static StringContent? BuildBodyParams(SessionInfo si, JObject bodyParams, Encoding? encoding = null, string mediaType = "application/json")
Returns​

System.Net.Http.StringContent

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
Newtonsoft.Json.Linq.JObjectbodyParams
System.Text.Encodingencoding
System.StringmediaType

BuildBodyParams(SessionInfo, Dictionary<string, object>, Encoding?, string)​

Declaration
public static StringContent? BuildBodyParams(SessionInfo si, Dictionary<string, object> bodyParams, Encoding? encoding = null, string mediaType = "application/json")
Returns​

System.Net.Http.StringContent

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.Collections.Generic.Dictionary<System.String,System.Object>bodyParams
System.Text.Encodingencoding
System.StringmediaType

ExecuteWebServiceRequest(SessionInfo, HttpClient, HttpRequestMessage, bool, bool)​

Declaration
public static HttpResponseMessage ExecuteWebServiceRequest(SessionInfo si, HttpClient client, HttpRequestMessage requestMsg, bool raiseOnFailedStatus = true, bool logErrors = true)
Returns​

System.Net.Http.HttpResponseMessage

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.Net.Http.HttpClientclient
System.Net.Http.HttpRequestMessagerequestMsg
System.BooleanraiseOnFailedStatus
System.BooleanlogErrors

RequestHttpClient(SessionInfo, HttpClient, HttpRequestMessage, TimeSpan, int, bool, bool)​

Declaration
public static HttpResponseMessage RequestHttpClient(SessionInfo si, HttpClient client, HttpRequestMessage requestMsg, TimeSpan retryInterval, int maxRetries = 3, bool raiseException = true, bool logError = true)
Returns​

System.Net.Http.HttpResponseMessage

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.Net.Http.HttpClientclient
System.Net.Http.HttpRequestMessagerequestMsg
System.TimeSpanretryInterval
System.Int32maxRetries
System.BooleanraiseException
System.BooleanlogError

RequestHttpClientWithRetry(SessionInfo, HttpClient, HttpRequestMessage, TimeSpan, int)​

Declaration
public static HttpResponseMessage RequestHttpClientWithRetry(SessionInfo si, HttpClient client, HttpRequestMessage requestMsg, TimeSpan retryInterval, int maxRetries = 3)
Returns​

System.Net.Http.HttpResponseMessage

Parameters​
TypeName
OneStream.Shared.Common.SessionInfosi
System.Net.Http.HttpClientclient
System.Net.Http.HttpRequestMessagerequestMsg
System.TimeSpanretryInterval
System.Int32maxRetries

Inherited Members​

  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object,System.Object)
  • System.Object.GetHashCode
  • System.Object.GetType
  • System.Object.MemberwiseClone
  • System.Object.ReferenceEquals(System.Object,System.Object)
  • System.Object.ToString

Was this page helpful?