Query and Fields via API.

Query and Fields via API.



Query and Fields via API.



Introduction


Welcome, this is a tutorial to help understand the query and fields via API.


Query and Fields



As of version , some of the terminals support the query parameters and . These two fields are special because they accept a json object. If an invalid json object is passed, the request will fail.  query fields


Query Parameter Information


query json object that accepts query operators MongoDB


fields json object with properties that have or to include or exclude them.  1 0




Query Examples


To query users who have a name somewhere.


https://<myoffice>/api/v1/users.list?query={ "name": { "$regex": "g" } }


Observation

The allowed structure is EJSON , which is similar to JSON, except in the fields and . For query objects that use fields, use the structure as shown in the example below.:  Date   binary   Date

query={"_updatedAt": {"$gt": { "$date": 1542814057 } }} 

or

query={"_updatedAt":{"$gt":{"$date":"2018-11-21T15:27:28.202Z"}}}


Field Examples

To return just the usernames of the users, you would do something like this:

http://localhost:3000/api/v1/users.list?fields={ "username": 1 }


Top tip: providing a value of will return all other fields fields {"_id": false, "value": false}




In case of doubts or suggestions, contact support via email: suportebr@myhive.global


    • Related Articles

    • Paging via API

      Paging via API. Introduction Welcome, this is a tutorial to help understand how to count, offset, sort via API. As of version, some of the endpoints support query parameters, and . However, the defaults are different by server due to configuration ...
    • List users and information via API

      List users and information via API Introduction Welcome, this is a tutorial to list users and their information via API. Listing Gets all users in the system and their information, the result is limited only to what the receiver has access to view. ...
    • Creating user via API.

      Creating user via API. Introduction Welcome, this is a tutorial to login via API Parameters URL Require Authentication Method HTTP /api/v1/users.create yes POST Variables Note: To save customFields, you must first define customFields in the admin ...
    • Disable users via API.

      Disable users via API. Introduction Welcome, this is a tutorial to disable user via API. Note: Disable inactive users. Permission required:    edit-other-user-active-status. Parameters URL Require Authentication Method HTTP ...
    • Set status via API

      Set status via API. Introduction Welcome, this is a tutorial to help set status via API. Defines a user status when status message and status are provided. Arguments: URL Require Authentication Method HTTP /api/v1/users.setAvatar yes POST  Payloads ...