Skip to content

[API] message history API - filtering and pagination #3

@baldoalessandro

Description

@baldoalessandro

THE CURRENT EXAMPLE DON'T WORK

Filtering syntax

Custom filtering is implemented using the python syntax for mongo query filters, see mongo db documentation for all the available.

e.g. if we want to filter only the echo messages our call would be something like the following:

curl -b iottly_cookie -H 'Content-Type: application/json' https://iottly.com/v1.0/project/<project id>/messages/<device id>?queryJson=%7B%22echo%22%3A%20%7B%22%24exists%22%3A%20true%7D%7D

where the queryJson contains the url encoded representation of the following JSON:

{
    "echo": {
        "$exists": true
    }
}

Paginating results

FIXME: example does not work :(

Pagination can be implemented using the queryJson to filter the data by timestamp:

curl -b iottly_cookie -H 'Content-Type: application/json' https://iottly.com/v1.0/project/<project id>/messages/<device id>?queryJson=%7B%0D%0A%20%20%20%20%22timestamp%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22%24lte%22%3A%20%7B%22%24date%22%3A%20%222017-04-19T10%3A47%3A58.133%22%7D%0D%0A%20%20%20%20%7D%0D%0A%7D

where the queryJSON contains the url encoded representation of the following JSON:

{
    "timestamp": {
        "$lte": {"$date": "2017-04-19T10:47:58.133Z"}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions