Android Question post string issue

fricentric

Member
Licensed User
Longtime User
hii!
i wanted to send data to server using poststring. i don't know where m going wrong.please can anyone help me out.

Code: Copy
job1.PostString("https://abc.com/hello", "q=&parameter1 & p=& parameter2")
   job1.GetRequest.SetContentType("application/x-www-form-urlencoded")

parameter1 and parameter2 are variables having some data.
the response from server i get is : parameter2 is not supplied.
what is going wrong?
 
hii!
i wanted to send data to server using poststring. i don't know where m going wrong.please can anyone help me out.

Code: Copy
job1.PostString("https://abc.com/hello", "q=&parameter1 & p=& parameter2")
   job1.GetRequest.SetContentType("application/x-www-form-urlencoded")

parameter1 and parameter2 are variables having some data.
the response from server i get is : parameter2 is not supplied.
what is going wrong?

The parameters:
q=&parameter1 & p=& parameter2

is

q=parameter1&p=parameter2

Type

Code: Copy
job2.Initialize("Job2", Me)
   job2.PostString("https://abc.com/hello", "first key=first value&key2=value2")
 
Upvote 0
the server variables are correct. thing is, the parameter2 is 1st activity's variable which is used in 2nd activity to pass it to server (api call is made in 2nd activity). but if i log the parameter2 i get the proper value to be passed but after making api call the response is : no parameter2 is supplied.

parameter2 and parameter1 are variables which contains the value to be passed to server so any difference it will make it for postString syntax?
 
Last edited:
Upvote 0
Please try to set the values hardcoded for a quick test (to see if the server api is working as expected).

After that move the variables to process_globals (even better: to a service which holds all data and doing the okhttputils calls - much easier)
 
Upvote 0
same issue after hardcoding the values also.
server calls are working fine. i tried that on postman and it gives proper response.
 
Last edited:
Upvote 0
try to add this
Code: Copy
job1.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36")
    job1.GetRequest.Timeout= 30000
    job1.GetRequest
]
also do you have other requests except the one that is causing issue?
and tried with http insted of okhttp or the opposite?
 
Upvote 0
yes there are actually 2 api calls being made. response of 1st is fed to 2nd.
din try with http. il give it a try for the response.
 
Upvote 0
Back
Top