on 2024 Feb 01 10:11 AM
For calling API's we are using the Webclient (from System.Net import WebClient)
Since importing .net namespaces or cpq namespaces is no longer possible due this restriction, we need a solution. But in the documentation on the 'Alternatives to CLR Module Import' page there is not trace of this on how to make it work without Webclient
Does anyone has an example on how to do it ?
Request clarification before answering.
Found it out myself:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I do not have an example with WebClient, but with WebRequest.
before:
newRequest = WebRequest.Create(TokenURL)
newRequest.Method = "POST"
newRequest.Headers.Add("AUTHORIZATION", RestClient.GetBasicAuthenticationHeader(Token, Password),)
newRequest.ContentLength = 0
response = newRequest.GetResponse()
data = StreamReader(response.GetResponseStream()).ReadToEnd()
dataInJson = JsonConvert.DeserializeObject(data)
accessToken = dataInJson.access_token.ToString()
After:
headers = { "Authorization": RestClient.GetBasicAuthenticationHeader(Token, Password) }
data = RestClient.Post(TokenURL, "", headers, False)
accessToken = data.access_token.ToString()
Please share your code.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.