Retrofit - Send a simple POST Request | Android Studio Tutorial
Вставка
- Опубліковано 13 сер 2020
- 🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN
stevdza-san.com
🐱👤 Wanna become a member? Join!
/ @stevdzasan
📸 Instagram
/ stevdza_san
Retrofit is a Type Safe REST client for Android Developed by square. It uses okHttp library for HTTP requests, and it's one of the best tools for performing network requests in android applications. In this video I'll show you how to send POST request. For those of you who are not familiar with POST request. Basically POST is used to send data to a server to create/update a resource. The data sent to the server with POST request is stored in the request body of the HTTP request and not in the URL!
Retrofit requires three main components:
1. Retrofit Instance:
We can create an instance of Retrofit by Retrofit.Builder class. And we have to specify the base url and converter factory at the time of the Retrofit instance creation
2. Model Class:
Retrofit needs a Model class for sending and receiving Request. It uses the model class for parsing server Response by using converters like Gson, Moshi etc.
3. An Interface for possible API calls:
The interface contains methods that represents possible API calls. Each methods need a base Url end point annotation that represents the Http methods like GET, POST etc.
Project Files: github.com/stevdza-san/Retrof...
You're the best android teacher, tq so much
Great touterial from talented expert. Thanks a million
Very useful video . Simply explained . Thank you!
I'm glad to help :)
What is differences of content type json with X Form url encoded?
Great Explanation. Well done
Very useful video . Thank you very much!
Is the request body and key value pairs encrypted while sending it to the server ?
thanks, that would be awesome if you could show how to post multipart (string and file)
Hey there! You’re my new favorite kotlin developer! Subscribed. :) 🙌👏
Thank you! 🙌
Thank You very much, Sir!)
I got response body and response code, but no response message. Do you know why is that?
What if I only get a status code back and not an object? I just want to know what status code I get back
Hello! Hope you are doing it great! Thanks for your videos and Udemy courses, definitely a worthy purchase! I have a question since I have been trying it like 8 hours and can't figure out how to do it. In the else of 'if(response.isSuccessful)' you can handle all the errors of the app, but how can I handle no internet connection? I tried with try, catch, modifying the code, etc... But I can't do it. Have a nice day!
hey i got similar problem,, have you found an answer to it yet?
Thanks bro!!!
Could you provide the Github link to this project?
Awesome video!
Is it necessary to use the "Response" class in the return of the method? you used "Response" but, couldn't it be only "post"?
Hello my "Observer "{ response->}
Didn't trigger what could be the problem??
@@vikasbhadoriya1466 Hello! Try checking the viewModel.{responsetype} you have used? in my case i was wating a list response and in reality the response is a single record.
hey, thank you for tutorials, can you tell the hotkey for getiing info about objects? you"re using this on 5:53
Ctrl+Q
@@StevdzaSan хвала Stefano:)
Please we need a new tutorial using daggerhilt with retrofit. thank you for all you do
@FormUrlEncoded is used to send simple data to the sever via Post method and it is not human readable form compared to Json, anyway great as intent!.
you are good guy!
"ahhh.. hello there"
instead wireshark, can we use Postman to test the API?
You can use anything you want
when i click on for the one time it sends only one reponse but when i press button another time it sends response 4 times
The observer must be outside the clicklistener
Hello my "Observer "{ response->}
Didn't trigger what could be the problem??
change function type to Response
Really enjoy your talking.
Thank you 💜
How to create buying system. EX: online course application (Udemy). please make a video 😘
hello , how would you insert and apikey ?
For some API you can pass it with GET request in a form of URL and for some of them you need to include it in headers. Next video will be about headers.
Do a tutorial on HILT.... Please bro
please, sir, it possible to encrypt request and response prevent reading of sent data? ❤️
Thank you for your suggestion I'll work on making new video about that.
@@StevdzaSan Thank you sir for quick reply , wish you more creativity
Hello my "Observer "{ response->}
Didn't trigger what could be the problem??
@@vikasbhadoriya1466 Hello! Try checking the viewModel.{responsetype} you have used? in my case i was wating a list response and in reality the response is a single record.
Please , Make a video about how to send Image using Retrofit ❤️❤️❤️
Please make retrofit file upload
Great .....Please, sir, make videos on Firestore (save data and retrieve , update )
hi sir help need pm me pls
like
was perfect in 0.75x haha
This is not helpful. Please make a video with your code starting from scratch, because viewers don't want to drown in a sea of code right from the beginning.
Great .....Please, sir, make videos on Firestore (save data and retrieve , update )
Great .....Please, sir, make videos on Firestore (save data and retrieve , update )
Great .....Please, sir, make videos on Firestore (save data and retrieve , update )