I
I
Incold2020-02-20 14:23:43
C++ / C#
Incold, 2020-02-20 14:23:43

Why can't I pass a parameter in a request?

I'm trying to pass parameters as a query string (using the GET method). Can I pass multiple parameters via ? concatenating them with & but fails with the filter parameter. The server ignores the filter and returns all fields. What am I doing wrong?

How I try:

string ApiAddress = "https://api.guesty.com/api/v2/reservations?filter={'field':'listing.title','operator':'$eq','value':['something']}"


A piece of json that comes to the request without filters:
"results": [{
            "_id": "1234qwerty",
            "accountId": "1234qwerty",
            "checkIn": "2020-02-22T10:00:00.000Z",
            "checkOut": "2020-02-24T09:00:00.000Z",
            "confirmationCode": "QWERTY",
            "guest": {
                "_id": "1234qwerty",
                "fullName": "qwerty"
            },
            "guestId": "1234qwerty",
            "integration": {
                "_id": "1234qwerty",
                "limitations": {
                    "availableStatuses": []
                },
                "platform": "airbnb"
            },
            "listing": {
                "_id": "1234qwerty",
                "title": "something"
            },
            "listingId": "1234qwerty"
        },


API documentation: https://docs.guesty.com/#search-reservations

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2020-02-20
@petermzg

So they ask to transfer a json array, not a json object. Add "[ ]"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question