restsharp

ExecuteAsyncPost Example in RestSharp.NetCore

旧时模样 提交于 2019-12-05 09:25:18
I'm working with RestSharp.NetCore package and have a need to call the ExecuteAsyncPost method. I'm struggling with the understanding the callback parameter. var client = new RestClient("url"); request.AddParameter("application/json", "{myobject}", ParameterType.RequestBody); client.ExecuteAsyncPost(request,**callback**, "POST"); The callback is of type Action<IRestResponse,RestRequestAsyncHandler> Would someone please post a small code example showing how to use the callback parameter with an explanation. Thanks -C This worked for me using ExecuteAsync for a Get call. It should hopefully

Deserialize JSON object to C# object

余生颓废 提交于 2019-12-05 04:45:22
问题 Im trying to read some json data using RestSharp. But im having some problems reading json objects. I have this respons: expand: "html", self: "<url>/INCIDENT-447", key: "INCIDENT-447", fields: { customfield_11414: { name: "Corrective Measures", type: "com.atlassian.jira.plugin.system.customfieldtypes:textarea" }, summary: { name: "summary", type: "java.lang.String", value: "BLA BLA BLA" }, I need to create a object with Property's summery and customfield_11414 But i only need the value of

WP7 - Prevent RestSharp from caching

Deadly 提交于 2019-12-05 02:06:02
问题 I use RestSharp in my Windows Phone 7.1 project. My problem is RestSharp always cache response data. Example: At the first time I send request, it returns data correctly. After some delete operations, I send that request again, but response seems the same as the first time, nothing's changed. If I stop debugging and press F5 to start again, it works perfectly as expected. I also tried request.AddParameter("cache-control", "no-cache", ParameterType.HttpHeader); and got no luck. How can I fix

Is there a RestSharp implementation that works with Portable Class Libraries?

感情迁移 提交于 2019-12-05 01:10:21
When I try to add RestSharp to a portable class library project using nuget, I get the following: Could not install package 'RestSharp 104.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile104', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. I assume then it is not supported? If that be the case anyone have any suggestions on how to get this to work? Nicola Iarocci Another interesting option is Flurl Flurl is a

HttpStatus and DownloadData

戏子无情 提交于 2019-12-05 00:30:11
I'm trying to download a file (an image) with RestSharp using the DownloadData method var client = new RestClient(baseUrl); var request = new RestRequest("GetImage", Method.GET); var response = client.DownloadData(request); This works fine, but if the requests returns an error I cannot see the HttpStatus code. I could make a Request and check the status: var client = new RestClient(baseUrl); var request = new RestRequest("GetImage", Method.GET); var response = client.Execute(request); var status = response.StatusCode; But then I cannot get the image from the Content property. I'm I missing

RestSharp PUT XML, RestSharp is sending it as GET?

我是研究僧i 提交于 2019-12-04 20:36:42
I am attempting to edit a product using the prestashop API, using RestSharp in C#, using XML. The documentation's instructions are as follows: To edit an existing resource: GET the full XML file for the resource you want to change (/api/customers/7), edit its content as needed, then PUT the whole XML file back to the same URL again. I am attempting to edit /customers/1. My GET calls are working fine to retrieve the data. I am now deserializing the data, editing it as needed, and re-saving to an XML file. All seems to be going well. The only fields I am attempting to change right now are

In C#, how do I model a JSON object with multiple nested arrays?

人盡茶涼 提交于 2019-12-04 19:56:37
问题 I am getting this JSON response from a system I am connecting to and trying to figure out the best way to deserialize it into a C# object. I am currently using RestSharp which seems pretty straight forward to use but the format of the JSON is baffling me a bit. Here is the format that its coming in as: [ {"name": "Tickets:", "schema": [ {"dataType": "string", "colName": "First", "idx": 0}, {"dataType": "string", "colName": "Second", "idx": 1}, {"dataType": "string", "colName": "Name", "idx":

example of parsing a receipt for an in-app purchase using iOS Xamarin?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 18:11:34
I am trying to implement purchase validation for my app. I see that I can send the purchase receipt to my server to verify with Apple. However, I cannot figure out the correct way to POST the NSData to my URL for validation. Something like this: public void CompleteTransaction (SKPaymentTransaction transaction) { var productId = transaction.Payment.ProductIdentifier; NSUrl receiptURL = NSBundle.MainBundle.AppStoreReceiptUrl; NSData theData = NSData.FromUrl (receiptURL); RestRequest request = new RestRequest(validationURL, Method.POST); request.AddBody(theData); // ?? restClient.ExecuteAsync

Adobe Sign (echo sign) API sending document using C#

北城余情 提交于 2019-12-04 17:09:21
Okay I have limited understanding of working with API's Im trying to get to grips with Adobe Sign API and hit a dead end, on there test page i have enterd this and it works But i have no idea on how then do that in C# I have tried the following, but know its missing the OAuth stuff and I'm just not sure what to try next. by the way foo.GetAgreementCreationInfo() just gets the string that is in the screen shot, I just moved it out cus it was big and ugly var foo = new Models(); var client = new RestClient("https://api.na1.echosign.com/api/rest/v5"); // client.Authenticator = new