How can I make request like "Include filter" in android using retrofit on loopback backend?

axios get request with params
axios post headers
axios cheat sheet
axios get headers
axios post react
axios typescript
axios vs request
axios tutorial

I would like to know how to make Include filter request in android using retrofit. This is how the request looks like in loopback.

{
"filter": {     
    "counts":["agendas"],
    "include":["meetingHall"]
    }
}

This is how the response from the loopback server looks like

{
"count": 1,
"rows": [
    {
        "meetingId": "2010-5-8",
        "titleEn": "horticulture follow up final report.",
        "descriptionEn": "Management Letter Gewane Collage ኣፈጉባኤ ፎረም tigray.pdf ኣፈጉባኤ ፎረም tigray.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf",
        "titleAm": "horticulture follow up final report.",
        "descriptionAm": ".የአካባቢ ደንና አየር ንብረት ለውጥ  ኣፈጉባኤ ፎረም tigray.pdf ኣፈጉባኤ ፎረም tigray.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf የፌደራል መንግስት የህግ አወጣጥ.pdf",
        "status": "FINISHED",
        "finishDetail": {
            "attendanceNo": 0,
            "remark": ""
        },
        "postponeDetail": null,
        "cancelDetail": null,
        "startDateGe": "2018-09-10T00:00:00.000Z",
        "startDateEt": "2010-13-05",
        "startTimeGe": {
            "hour": 10,
            "minute": 0
        },
        "startTimeEt": {
            "hour": 10,
            "minute": 0
        },
        "isArchive": false,
        "regularMeetingDetail": {
            "meetingNo": 8,
            "round": 5,
            "year": 2010
        },
        "seenStatus": 0,
        "id": "5b926b5b9fab48001459004e",
        "meetingHallId": "5b926a899fab480014590049",
        "userGroupIds": [
            "5b926a5b9fab480014590045",
            "5b926a619fab480014590046"
        ],
        "createdAt": "2018-09-07T12:13:15.880Z",
        "updatedAt": "2018-09-18T12:43:28.577Z",
        "meetingTypeId": "5b92668c9fab480014590021",
        "agendasCount": 1,
        "meetingHall": {
            "nameEn": "በቋሚ ኮሚቴ አዳራሽ\t",
            "nameAm": "በቋሚ ኮሚቴ አዳራሽ\t",
            "id": "5b926a899fab480014590049",
            "createdAt": "2018-09-07T12:09:45.776Z",
            "updatedAt": "2018-09-07T12:09:45.776Z",
            "name": "",
            "description": ""
        }
    }
]

}

Because of that in the response other attributes have been serverd which normaly would take for more than just one request at the time... my Point is I would liek to know what my endpoint calling looks like for my retrofit in android.

sample api calls

 @GET(ENDPOINT_MEETING)
 @Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
 Observable<MeetingsResponse> loadMeetings(@Query("isArchive") Boolean isArchive);

reference for this kind of request can be found in the official page of loopback in here How can I make my request? should I use Query of any other properties? Thanks!

Looks like you are sending this data in body of request so use this :

create class of your request body like :

for filter FilterRequestWrapper.java :

public class FilterRequestWrapper {
  /*  {
"filter": {
    "counts":["agendas"],
    "include":["meetingHall"]
    }
}
*/

    @Expose
    public FilterRequest filter;

    public class FilterRequest {
        @Expose
        public List<String> counts;
        @Expose
        public List<String> include;

    }
}

And use it like :

@GET(ENDPOINT_MEETING)
@Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
Observable<MeetingsResponse> loadMeetings(@Query("isArchive") Boolean isArchive, @Body FilterRequestWrapper filterRequestWrapper);

Is an entity body allowed for an HTTP DELETE request?, message, most likely for storing it. It is often used when uploading a file or when submitting a completed web form. Making Requests Do you think you could … ? This page lists useful expressions for the language function of making a request for something or some action from other people.

You can include filters in your request like this

@GET(ENDPOINT_MEETING)
 @Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
 Observable<MeetingsResponse> loadMeetings(@Query("isArchive") Boolean isArchive,@Query("filter" String filter);

How to send HTTP Requests in React, Dynamically create <input> s in a form and submit it. /** * sends a request to the specified url from a form. this will change the window location. * @param {string}​  A request letter is important to politely express the legitimate demands that one would like to be met by the reader. This letter enables one to air their views, grievances, or requests in writing. A request letter can be used as a document for reference in the future.

The endpoint to the API and how I called it

@GET(ENDPOINT_MEETING)
@Headers(ApiHeader.API_AUTH_TYPE + HEADER_PARAM_SEPARATOR + ApiHeader.PROTECTED_API)
Observable<MeetingsResponse> loadMeetings(@Query("filter") String meetingFilter);

How I called it in my Presenter class

    getMvpView().showLoading();
    getCompositeDisposable().add(getDataManager()
            .loadMeetings("{ \"counts\":[\"agendas\"], \"include\":[\"meetingHall\"]}")
            //.loadArchiveMeetings()
            .subscribeOn(getSchedulerProvider().io())
            .observeOn(getSchedulerProvider().ui())
            .subscribe(meetingsResponse -> {

                        if (!isViewAttached()) {
                            return;
                        }

                        getMvpView().showMeetings(meetingsResponse.getMeetings());
                    },
                    throwable -> {

                        if (!isViewAttached()) {
                            return;
                        }

                        getMvpView().hideLoading();
                        if (!CommonUtils.getErrorMessage(throwable).isEmpty())
                            getMvpView().onError(CommonUtils.getErrorMessage(throwable));
                    }));

and this is how I implemented a filter in the GET request.

POST (HTTP), It is hard to ask for what you want, but you'll never get it unless you do. I always say, “If you don't ask, the answer is no. If you do ask, you immediately increase your  I’d like you to…. This phrase is used to make a more direct request. It is more like an order than a request. I’d like you to type these letters for me. I’d like you to do the shopping for me. I’d like you to pick up the children from school. I’d like you to help me with the housework.

JavaScript post request like a form submit, request.get('http://mysite.com/doodle.png').pipe(resp). } } }) You can also pipe() from http.ServerRequest instances, as well as to http. It depends on what that something is, but in general, do what you would for any formal email. Start with a basic greeting (e.g. Hello John). Add an opener that leads into your request (e.g. I hope you're semester is going well so far).

How to Ask for What You Want: 5 Easy Ways to Make a Request , As GET requests do not change the state of the resource, these are said to be safe methods. Additionally, GET APIs should be idempotent, which means that  A FOIA request can be made for any agency record. You can also specify the format in which you wish to receive the records (for example, printed or electronic form). The FOIA does not require agencies to create new records or to conduct research, analyze data, or answer questions when responding to requests.

request, Hence, PUT is idempotent. HTTP DELETE. When you invoke N similar DELETE requests, first request will delete the resource and response will be 200 (OK)  Request TV shows or movies. Have a TV show or movie you'd like to see on Netflix? Tell us about it below! This form is the one and only place to submit content requests. Wondering why a TV show or movie was available and now it's gone? Check out Why do TV shows and movies leave Netflix? for more info!

Comments
  • Do I need to do the @SerializedName("counts") and @SerializedName("include") on top of @Expose annotation? for the FilterRequestWrapper class?
  • no its is required only if you name your variables different than actual, like counts, you could take countsForFiler and put @SerializedName("counts") above it.
  • hey Nehak, I checked other it elsewhere and I got this stackoverflow.com/questions/29834959/… can you tell me what you think about it concerning my situation. Thanks!
  • is it still not working for you? can you post actual request with body?
  • yes It didn't work since I was using retrofit and retrofit will return an error for trying to send a body inside a GET request .. so what I did for getting around this u can check it below. But thanks for the hint and your time!