Problems with retrofit2 calls format - android

I am experiencing some issues with a retrofit call to the backend. I explain you the situation:
I have developed the API call in the postman by the next way:
In the Android studio I try to do the API call by the next way:
#GET("restricted/GaiakIkuskatzea")
Call<Gaiak> getGaiak(#Query("grupo") String grupo);
But what I get is a empty object of JSON type, as I got if in the postman I make an api call without the param I showed before, and with the parameter specifyed in the body:
Does any of you know why I am having porblems with the Studio?
Thanks!

The final answer was watching the name that recived the data that you were receiving, in my case I put http and observed the mistake.

Related

How to view result from JSON API in browser

I have a JSON API URL "http://myurl/getDataMethod" this takes a parameter "parameter1". How can I call this API in browser to view its result? Can I use JSFiddle to see the result on runtime? If not then can you provide code for viewing the result in Android app?
I tried calling the API in android App but I got error java.io.FileNotFoundException:, I don;t know why. Also my parameter is having # symbol which is getting converted to %40 when I call the URL through code in APP. I just want to view the data from this API by passing parameter, please help/advise. Thanks.
You can always use an API Tester tool like Postman for testing/viewing the response received from an API. Also if your API method is GET, you can even use a browser by passing the relevant query parameters.
When you try to call an API from a browser, the entire URL gets Encoded so # becomes %40
Use Postman software to access your api and its data anytime before you start coding so as to know the data structure and flow.
Refer to the Postman tutorials or official documentation to learn more about the working
Postman documentation link:
https://learning.getpostman.com/docs/postman/api-documentation/documenting-your-api/

Android stripe CustomerSession.addCustomerSource() not working

I am using Stripe's PaymentMethodActivity to add a payment source. When adding a credit card, I can debug all the way until this line of code in Stripe's AddSourceActivity:
CustomerSession.getInstance().addCustomerSource(
this,
source.getId(),
sourceType,
listener);
The listener callbacks never get called and the progress bar on the AddSourceActivity keeps going indeterminately. This was working before, but I suspect this issue may be related to our recent backend overhaul. Could there be an issue with the api version when creating the ephemeral key?
I found a solution. I wasn't correctly handling the response from our backend when requesting a new ephemeral key. Originally I had deserialized the response into an object and then converted that object to a json string to pass to Stripe. I corrected the problem by directly using the string representation of the response instead of doing any unnecessary serialization steps.

asp.net post action error on retrofit calling but okey on manual calling

I am using asp.net webapi v2 to create a rest api, everything is OK ! the GET request handled well, but I have a problem with POST request. I write a POST method in the Controller, and can call it using Postman. But when I try to call POST request with retrofit in my android app, it fails and get me this error : 405 Method Not Allowed.
It seems that every thing is okey but I don't know whats the problem !
this is my retrofit rest service :
#FormUrlEncoded
#POST("/Report")
void sendReport(#Field("UniqueID") String UniqueID, #Field("ShopID") long ShopID, #Field("Content") String Content, Callback<Boolean> callback);
I should mention that I've return bool in my POST action ! can it cause the problem because of Boolean in the retrofit ?!
what should I do now ?
Finally I found the solution, but I don't know why this happened !
The problem was the URL endpoint, It seems that POST method in webapi are case sensitive and I should use report against Report !!! (That was not happen in GET cases)
Another problem was the www prefix ! when I remove that it works like a charm but again it doesn't matter in GET cases !!!
I post this answer to help someone with the similar case ... hope so.

Android: Fail to retrieving a tag value of the EWS response

I am hitting my Exchange server using (EWS+Basic Authentication). I could authenticate and hit my services with these Request GetItem (E-mail Message),SyncFolderItems and few other and getting the response successfully. I could parse the SyncFolderItems response to get basic info abt the Mail Items (Like Subject,To,From,HasAttachments etc.). But when i hit the GetItem request i am receiving a response but i couldnt get the Mail item Body (i.e, the Message). Is it any tutorial to do this. I am using XMLPullParser..
The response might be look like this . Plz guide me on this
I've used JWebServices for Exchange (Android version) several times. It's not free but accomplished what I needed. You should try the API to see if they get correct Body to see if your application fails or body is empty.
Thanks for ur valuable replies.. I found the data (values) that i stored from the saxparser is not complete. So only i couldnt get the html content properly in the webview.
i used the following link as reference and used the string buffer to resolve this issue.
Thx

ksoap2-android client throwing FileNotFoundException inside [KeepAlive]HttpsTransportSE.call()

I am attempting to create an Android (2.2) SOAP client to connect to a SQL Server 2005 XML Web Services endpoint (and of course this requires authentication). My SQL Server endpoint seems to be up and running (it's a simple function which takes a string (varchar(20)) and returns another string; the URL "https://10.1.1.20:444/dt2?wsdl" properly returns the WSDL XML. (I am not using the "?wsdl" part of the URL in my connection string; I just mention it to show the web service is working properly.)
All seems to be working well, until I am inside the call to KeepAliveHttpsTransportSE.call() (using ksoap2-android 2.5.4), and get to HttpTransportSE.class:150, where (ServiceConnection)connection.openInputStream() is called, which in turn calls connection.getInputStream() - that is what throws the FileNotFoundException.
Any idea what's happening here? What is a good next debugging step? Thanks for any input.
See the following question for more detail and the answer to the problem: Getting ParsingError, InvalidSoapActionHeader on SQL Server SOAP request

Categories

Resources