http-post

Upload file to DataSnap REST server via TStream

让人想犯罪 __ 提交于 2019-12-01 12:24:52
I've built a DataSnap REST server using Delphi XE2 and I've added a server method for uploading files via TStream : function TServerMethods.updateUploadFile(sFilename: string; UploadStream: TStream): string; I want to be able to call this from a number of different clients (Android, iOS etc) and I've been testing the method using various REST clients such as Postman (Chrome plugin). However so far I cannot get it to accept the content for the HTTP POST body. Whenever I send the POST command I always get the following response : {"error":"Message content is not a valid JSON value."} I've tried

HttpPost -> Redirect -> Location or body of response needed

五迷三道 提交于 2019-12-01 12:21:36
Here is Java code that POSTs data to a website and than gets redirected as a response (status 302). It works perfectly on my PC (Eclipse, Java, Ubuntu), it does exactly what I want it to do. I tried quite everything to post the code functionality but I just am not able to. Java code: // Preparing the CLIENT and POST Method HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://na.leagueoflegends.com/ladders/solo-5x5"); try { // Add your POST METHOD attributes List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new

Angular Promises and Chaining: How to break a chain if it has business data errors

怎甘沉沦 提交于 2019-12-01 12:17:34
I thought that I had this all figured out on previous projects through the years.. Apparently not. Goal : Take Service that calls other Services and if there is any type of error being returned ( not a status of 200 ) then I need the async thing to be waiting and not proceeding. Seems to me like I don't ever see really that great of examples as it is all very simplistic. I read various articles about what Angular (1) is doing under the hood , and i see that there are $q, .then, .success etc.. Seems that I am having issues with return and with other nested and bundled service calls being made

HTTP Post from Windows Forms application C#

泪湿孤枕 提交于 2019-12-01 11:59:20
问题 I need to write a forms application in C# that sends parameters via HTTP POST to a url, and gets back the response. I really don't realize where to start this, is it possible at all ? Thanks in advance, Gal. 回答1: As a start please see 1- HttpWebRequest Class 2- HttpWebResponse Class 3- WebClient Class in MSDN Please see Here 回答2: This isn't in C# but you should be able to intepret it. var Bytes: Array of Byte; Request: HttpWebRequest; RequestStream: Stream; Response: HttpWebResponse;

HttpPost -> Redirect -> Location or body of response needed

本秂侑毒 提交于 2019-12-01 11:56:31
问题 Here is Java code that POSTs data to a website and than gets redirected as a response (status 302). It works perfectly on my PC (Eclipse, Java, Ubuntu), it does exactly what I want it to do. I tried quite everything to post the code functionality but I just am not able to. Java code: // Preparing the CLIENT and POST Method HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://na.leagueoflegends.com/ladders/solo-5x5"); try { // Add your POST METHOD

Angular Promises and Chaining: How to break a chain if it has business data errors

旧城冷巷雨未停 提交于 2019-12-01 11:55:15
问题 I thought that I had this all figured out on previous projects through the years.. Apparently not. Goal : Take Service that calls other Services and if there is any type of error being returned ( not a status of 200 ) then I need the async thing to be waiting and not proceeding. Seems to me like I don't ever see really that great of examples as it is all very simplistic. I read various articles about what Angular (1) is doing under the hood , and i see that there are $q, .then, .success etc..

POST request to REST API with JSON object as payload

我的梦境 提交于 2019-12-01 11:21:44
问题 I am trying to get the JSON response from the REST API using the POST request that has JSON payload (should be converted to URL encoded text before sending). I have followed some tutorials to implement the process but I get error with status code 400. I may not be encoding the given JSON string or missing something. Please help me solve this problem. Thanks. Here is my code try { URL url = new URL("https://appem.totango.com/api/v1/search/accounts/health_dist"); HttpURLConnection conn =

not getting response response = httpclient.execute(request);

只谈情不闲聊 提交于 2019-12-01 11:19:37
public class HTTPPoster { public static HttpResponse doPost(String url, JSONObject c) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); HttpPost request = new HttpPost(url); HttpEntity entity; StringEntity s = new StringEntity(c.toString()); s.setContentEncoding((Header) new BasicHeader(HTTP.DEFAULT_CONTENT_CHARSET, "application/json")); entity = s; request.setEntity(entity); HttpResponse response; response = httpclient.execute(request); return response; } } This is the code but on response = http.client.execute(request) doesn't get response. I

HTTP POST on Android

核能气质少年 提交于 2019-12-01 09:21:09
I want to make a simple HTTPRequest to a php script and I have tried to make the very most basic of apps to get the functionality working. I want to test that my app is sending the data I feed it so I've made the android app send to a server and that server is supposed to send me the data I've put into the app. The code for the "postData" function is to send data from android to the server and the code for the "default.php" is the recieving php file on a webserver which then forwards the data to my email address (not given). Here is the code public void postData() { // Create a new HttpClient

HTTP Post Request in Objective-C Not Working

被刻印的时光 ゝ 提交于 2019-12-01 07:28:04
问题 I am writing an HTTP Post request, but for some reason the parameters are not being added correctly, and I can't for the life of me figure out what I'm doing wrong. Here's what I have: NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData]; [request setHTTPShouldHandleCookies:NO]; [request setTimeoutInterval:30]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"--------------------------