restsharp

Request timeout from ASP.NET Core app on IIS

心不动则不痛 提交于 2019-12-01 17:08:24
I make a web request to a third-party api from my ASP.NET Core application. When app is running alone itself, request succeeds. When app is running in IIS on the same server, request timeouts. Request is made from a Hangfire recurring job to Asana API endpoint (HTTPS) via RestSharp client. All the own app's pages are available through IIS, but app cannot make any requests. Where should I look and what to debug to solve this problem? IIS behavior is driven by the web.config, I have configured to deal with request < 20 min specifying requestTimeout="00:20:00" : <aspNetCore requestTimeout="00:20

RestSharp RestResponse is truncating content to 64 kb

♀尐吖头ヾ 提交于 2019-12-01 13:34:42
Hi I am using the RestSharp to create the request to my web API. Unfortunately the response.content does not contain full response, which I am able to see when I perform request through browser or fiddler. The content is being truncated to 64 kb. I am attaching my code below. Could you please advice what could solve this issue? var request = new RestRequest("Products?productId={productId}&applicationId={applicationId}", Method.GET); request.RequestFormat = DataFormat.Json; request.AddParameter("productId", id, ParameterType.UrlSegment); request.AddParameter("applicationId", Settings

How can I POST (as XML) an object to my ApiController using RestSharp?

心不动则不痛 提交于 2019-12-01 09:08:13
I have an ASP.NET MVC4 website implementing a REST API, which I'm consuming from a client application. My ApiController methods take and return complex objects, as XML. I recently discovered RestSharp, and have begun moving my client project over to that. However, I'm having real problems with it. It seems to almost work - it's so close that I can almost taste success - but I just can't get it to work 100%. The objects I'm passing across the wire look something like this: // The object I'm passing across the wire public class Example { bool IsActive { get; set; } string Name { get; set; } } My

RestSharp ignores response charset encoding

我们两清 提交于 2019-12-01 07:48:58
问题 I'm using RestSharp version 105.1.0 (.NET 4.5.1) to make a REST call to our own API. This API sends responses with the following header of particular interest: Content-Type: application/json; Charset=iso-8859-1 . As you can see, the charset of this response is set to iso-8859-1. I would expect that the response I get from RestSharp uses this encoding to decode the response content. However, when I look at the RestResponse.Content property, some characters display as �. As far as i know this

Testing the Deserialization of RestSharp without proper REST-Api

て烟熏妆下的殇ゞ 提交于 2019-12-01 07:37:46
EDIT: The solution to the question can be found in the first comment by John Sheehan! i would like to use Restsharp as Rest-Client for my Project. Since the REST server is not running yet, I would like to test the client without the Server. My main focus is on the deserialization of the returning XML-Response. Is it possible to deserialize XML using RestSharp without a proper RestSharp.RestResponse? I tried it like this: public void testDeserialization() { XmlDeserializer d = new XmlDeserializer(); RestSharp.RestResponse response = new RestSharp.RestResponse(); string XML = @"<Response><Item1

Serialize an object when posting data with RestSharp

匆匆过客 提交于 2019-12-01 04:22:30
I've recently started using RestSharp to consume a REST service which uses XML. It makes deserializing objects from XML to a collection of custom objects trivial. But my question is what is the best way to reserialize when posting back to the service? Should I use LINQ-to-XML to reserialize? I tried using the Serializeable attribute and a SerializeToXml utility function, but when I do so it seems to break the deserializing performed by RestSharp. tor.flatebo I have been able to use attributes to get all of what I need, although my situation is relatively simple. For example, to get it to

How to add json to RestSharp POST request

本小妞迷上赌 提交于 2019-12-01 03:09:26
I have the following JSON string that is passed into my c# code as a string parameter - AddLocation(string locationJSON): {"accountId":"57abb4d6aad4","address":{"city":"TEST","country":"TEST","postalCode":"TEST","state":"TEST","street":"TEST"},"alternateEmails":[{"email":"TEST"}],"alternatePhoneNumbers":[{"phoneNumber":"TEST"}],"alternateWebsites":[{"website":"TEST"}],"auditOnly":false,"busName":"593163b7-a465-43ea-b8fb-e5b967d9690c","email":"TEST EMAIL","primaryKeyword":"TEST","primaryPhone":"TEST","rankingKeywords":[{"keyword":"TEST","localArea":"TEST"}],"resellerLocationId":"5461caf7-f52f

RestSharp compress request while making rest call to server

假如想象 提交于 2019-12-01 00:42:32
I am consuming a rest api written in java in my C# client. I was pumping hell lot of data to server and I was using RestSharp.dll for the purpose of making rest calls. What I will do is construct an object and add that directly in body of RestSharp request object and mention .netserializer for it. So it will automatically serialize it and post it. All works great. Now I need to apply LZO or GZIP compression. So that server will have less load. I know how to implement both compression techniques. But how to implement it with RestSharp request object? What I got to do. I am adding object to body

How to add json to RestSharp POST request

故事扮演 提交于 2019-11-30 22:16:58
问题 I have the following JSON string that is passed into my c# code as a string parameter - AddLocation(string locationJSON): {"accountId":"57abb4d6aad4","address":{"city":"TEST","country":"TEST","postalCode":"TEST","state":"TEST","street":"TEST"},"alternateEmails":[{"email":"TEST"}],"alternatePhoneNumbers":[{"phoneNumber":"TEST"}],"alternateWebsites":[{"website":"TEST"}],"auditOnly":false,"busName":"593163b7-a465-43ea-b8fb-e5b967d9690c","email":"TEST EMAIL","primaryKeyword":"TEST","primaryPhone"

Getting signature_invalid calling oauth/request_token for Etsy's API using RestSharp

巧了我就是萌 提交于 2019-11-30 21:49:41
I'm trying to use RestSharp to access Etsy's API. Here's the code I'm using attempting to get an OAuth access token: var authenticator = OAuth1Authenticator.ForRequestToken( ConfigurationManager.AppSettings["ApiKey"], ConfigurationManager.AppSettings["ApiSecret"]); // same result with or without this next line: // authenticator.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters; this.Client.Authenticator = authenticator; var request = new RestRequest("oauth/request_token") .AddParameter("scope", "listings_r"); var response = this.Client.Execute(request); Etsy tells me that the