http-post

ASP.net Core RC2 Web API POST - When to use Create, CreatedAtAction, vs. CreatedAtRoute?

末鹿安然 提交于 2019-12-03 04:12:37
What are the fundamental differences of those functions? All I know is all three result in a 201, which is appropriate for a successful POST request. I only follow examples I see online, but they don't really explain why they're doing what they're doing. We're supposed to provide a name for our GET (1 record by id): [HttpGet("{id}", Name="MyStuff")] public async Task<IActionResult> GetAsync(int id) { return new ObjectResult(new MyStuff(id)); } What is the purpose of naming this get function, besides that it's "probably" required for the POST function below: [HttpPost] public async Task

Django returns 403 error when sending a POST request

萝らか妹 提交于 2019-12-03 04:07:00
问题 when I'm using following Python code to send a POST request to my Django website I'm getting 403: Forbidden error. url = 'http://www.sub.domain.com/' values = { 'var': 'test' } try: data = urllib.urlencode(values, doseq=True) req = urllib2.Request(url, data) response = urllib2.urlopen(req) the_page = response.read() except: the_page = sys.exc_info() raise When I'm opening any other website it works properly. domain.com is Django website too, and it works properly too. I think, that's Django

Post/Put/Delete http Json with additional parameters in Jersey + general design issues

六月ゝ 毕业季﹏ 提交于 2019-12-03 03:58:35
For some reason, I haven't found any normal way to do the following: I want to Post a json object, and add additional parameters to the call (in this case, an authentication token). This is a simple RESTful server in myUrl/server, which should give access to different resources of a "person" in the url myUrl/server/person/personCode/resourceName. GET is easy, and requires no object, only parameters. The problem arrises when I get to POST - how do I attach the JSON, and keep the other parameters as well? The class (much has been removed for clarity and proprietary reasons...): //Handles the

how to get POST data in django 1.3

为君一笑 提交于 2019-12-03 03:49:15
Hey, I am following this tutorial to learn to make a wiki page with Django. However, it is made in django 0.96 and I use Django 1.3 so there are some things that are different. Some I already fixed myself, however this one I can't seem to make it work. I made a form that submits data to a view. This is the form: <form method="post" action"/wikicamp/{{page_name}}/save/">{% csrf_token %} <textarea name="content" rows="20" cols="60">{{content}}</textarea><br> <input type="submit" value="Save Page"/> </form> and the /wikicamp/{{page_name}}/save/ url redirects to the save_page view: from django

cross-domain AJAX post call

↘锁芯ラ 提交于 2019-12-03 03:37:30
I've to make a POST call(with parameter) to an asp form which is located on another server. For development, I did this on the same server, and it works perfectly, but now I'm testing it on another server, and instead of receiving a 200 status, I receive a 0 status. I think it's because it's a cross-domain AJAX call, it's the only thing which changed. So how can I make this call? Is there any file I can put on the server/client to allow this call(like flash, ...)? Thank you! Yes, assuming you can change the server you connect to You can implement Cross Origin Resource Sharing (CORS) You need

Using System.Net.WebClient with HTTPS certificate

谁说我不能喝 提交于 2019-12-03 03:21:24
In my C# Windows client, I have a POST submission to "the mothership". I want the data in the submits to be secured, of course, so I paid for HostGator to issue me an SSL certificate. I saved off the .CER file, and I'm constructing the request as such: //wrapper for WebClient object to use certificate file class SecureWebClient : WebClient { protected override WebRequest GetWebRequest(Uri address) { HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address); string certPath = @"e:\mycertificate.cer"; X509Certificate myCert = X509Certificate.CreateFromCertFile(certPath); request

How to post to a request using node.js

喜你入骨 提交于 2019-12-03 02:18:15
问题 I am trying to post some json to a URL. I saw various other questions about this on stackoverflow but none of them seemed to be clear or work. This is how far I got, I modified the example on the api docs: var http = require('http'); var google = http.createClient(80, 'server'); var request = google.request('POST', '/get_stuff', {'host': 'sever', 'content-type': 'application/json'}); request.write(JSON.stringify(some_json),encoding='utf8'); //possibly need to escape as well? request.end();

How do I POST a buffer of JSON using libcurl?

旧城冷巷雨未停 提交于 2019-12-03 02:11:59
My C++ program currently invokes curl through a pipe ( popen("curl ...") ) to POST a file of JSON data to a web server. This has obvious performance limitations due to the need to save the JSON to a file and invoke curl in a subshell. I'd like to rewrite it to use libcurl, but it is not clear to me how to do this. The command line I pass to popen() is: curl -s -S -D /dev/null -H "Content-Type: application/json" -X POST -d file-of-json http://server/handler.php The JSON data (about 3K) is sitting in a buffer in RAM before I need to post it. I was expecting to use libcurl's CURLOPT_READFUNCTION

How to modify a request in Fiddler?

我的梦境 提交于 2019-12-03 01:37:38
问题 I'm looking for a simple way to intercept a web request and modify the contents of the request (mainly POSTs ) using Fiddler . This is to test server-side validation. I have to use Fiddler , however I haven't found a good simple way to do so. There have been several documented ways to write scripts to intercept traffic and change headers, but I would like to do it without writing a script - this tool needs to be used by the testers and writing/modifying scripts all the time by different

How to HTTPS post in Android

╄→尐↘猪︶ㄣ 提交于 2019-12-03 00:18:58
I have looked at the following links, but nothing seems concrete. Secure HTTP Post in Android This one does not work anymore, I have tested it and there are comments from other people saying it does not work. I also checked this out: DefaultHttpClient, Certificates, Https and posting problem! This seems it could work but the blogger just leaves you hanging. More step by step instructions would be helpful. I managed to get my certificate by I have not been able to follow through his second step. http://www.makeurownrules.com/secure-rest-web-service-mobile-application-android.html This one seem