http-post

Retrofit: How to send a POST request with constant fields?

谁说胖子不能爱 提交于 2019-12-03 23:37:51
I want to sent a simple POST request with one actual parameter: @POST("/token") @FormUrlEncoded void extendSession(@Field("refresh_token")final String refreshToken); But this request should also send some constant values requested by the server such as client_id , client_secret and grant_type which are constant and should not be part of the application API. What is the best way to do this? It is matter of your approach. If you have the constants you can build a default Map of values required for your call. @FieldMap will be suitable for building a Map with all your required fields private void

iMacros Http POST to API endpoint

徘徊边缘 提交于 2019-12-03 22:43:07
问题 I want to do an HTTP POST from inside an iMacro to an API endpoint. Effectively, something like the following: curl -d "data=foo" http://example.com/API In iMacros, it might look something like this: my-imacro.iim VERSION BUILD=10.4.28.1074 TAB T=1 URL GOTO=javascript:post('http://example.com/API', {data: 'foo'}); function post(path, params, method) { // Reference: http://stackoverflow.com/a/133997/1640892 method = method || "post"; var form = document.createElement("form"); form.setAttribute

Upload file by HTTP POST

谁都会走 提交于 2019-12-03 22:12:57
问题 I want to upload a file (an image specifically) to a REST Server using HTTP POST . I have already imported/add to build path httpmime-4.3.1.jar and apache-mime4j-0.6.jar . And I am getting the follow errors below in the Stack Trace. Is this valid? post.setHeader("enctype", "multipart/form-data"); HTTP POST Code public void multiPartPost() throws ClientProtocolException, IOException { File image = new File(EXTERNALSTORAGE + "/Pictures/sample.jpg"); FileBody fileBody = new FileBody(image);

POST request with AngularJS fails with preflight OPTION status code = 404 with CodeIgniter ResetServer

旧巷老猫 提交于 2019-12-03 21:44:55
My front-end application is running on a grunt live server on port 9100 , while my PHP server is on the port 80 . The host is the same, just the port differ. When I send a POST request to http://dev.site.dev/api/gist with some JSON data, I got an error 404 on the preflight OPTIONS request. I already added the CORS headers in apache configuration: Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Headers "X-Requested-With, accept, content-type" Header set Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS" ``` and restart the server but still got the issue.

How to send data from android to mysql server?

孤街醉人 提交于 2019-12-03 20:45:27
I am newbie to the android development. I am using Android Studio. I am making an app in which there is a dropdown list of names. On selecting any name, the corresponding ID of that name is shown at the app. Then there is a button which will search for the user's current gps coordinates and show them on the app. I searched for similar questions and found some links (I will post them at the end) but I couldn't understand them. Below is the screenshot of the app I have two tables in mysql; users and activity , as shown below Users Activity The UserId is the foreign key in activity table i.e. the

How to get the JSON from the Body of a Request on Go

六月ゝ 毕业季﹏ 提交于 2019-12-03 20:36:26
I'm a newbie with Go, but so far I'm liking it very much. I have a problem I can't figure out. I'm migrating an API from Node to Go and there is this log where I have to capture the Body of a POST AS IT IS and save it to a jsonb type column in a Postgresql database. This means I can't use a struct or anything predetermined. The POST is made with body raw Content-Type: application/json like so: { "debug": false, "order_id_gea": 326064, "increment_id_gea": 200436102, "date": "2017-05-18T01:44:44+00:00", "total_amount": 10000.00, "currency": "MXN", "payment_method": "Referencia bancaria",

Objective c - Send an image over http POST

心已入冬 提交于 2019-12-03 20:29:57
I'm trying to understand how to send an image with http POST and my current client-server protocol design. All the messages from client to server looks like the example below, there is a cmd string with parameter cmd and some more relevant parameters for the command. For example this is how i send a text message to the server: - (void)sendMessagesWithText:(NSString *)text fromUser:(NSString *)userId { NSString *url = SERVER_URL; NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; [request setURL:[NSURL URLWithString:url]]; [request setHTTPMethod:@"POST"];

How to obtain data from a form using method=“post”? How to request it data in my controller?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 18:16:33
问题 I am trying to obtain data from my html code like the "acquringCode", "cardAcceptor", and "merchantId". I can't figure how how to obtain that data in my controller. I know its request.form. I believe im doing it wrong. Is there an easier way for me to pass the object or each name as a parameter through the function? Html <script type="text/javascript"> $(document).ready(function () { $("#SavetreventLocationLookupAddButton").click(function () { $("#addSaveTreventLocationLookup").submit(); });

Android Multipart HTTP Post does not send the File's MIME type

倖福魔咒の 提交于 2019-12-03 17:20:39
问题 Trying to figure what's wrong with my codings. I followed a blog post from here. I managed to get the codes to actually upload the file to a PHP web service. However, for some reason although I've set explicitly the MIME type for the file, PHP shows that the MIME is just a blank string and therefore rejected. Here's my codings: public String SendPost(String fn, String bid, String caption, String uid, String APIKey, String postHash) throws ParseException, ClientProtocolException, IOException {

How to sent a POST request as json in plsql

 ̄綄美尐妖づ 提交于 2019-12-03 16:55:31
I have the following basic code which i use to post a plsql json request. The webservice getting executed doesnt have any response as it is simply for carrying out a certain task. But each time i execute the block, i get the status code 400 from Apache Tomcat. Where is it that i am going wrong? declare http_resp utl_http.resp; http_req utl_http.req; json_msg VARCHAR2(500); begin http_req := utl_http.begin_request('http://192.168.1.194:8080/NotificationApp/sendNotification.rest', 'POST'); utl_http.set_body_charset(http_req, 'UTF-8'); utl_http.set_header(http_req, 'Content-Type', 'application