1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

Query Commands

Discussion in 'Census: Developer Announcements' started by DanKinney, Dec 9, 2011.

  1. DanKinney

    DanKinney Guest

    A revised version of this thread can be found here:

    A Query Command is a particular query string that instructs the REST interface on how to organize the results that are to be returned. These are provided as Query String attributes but are namespaced with "c:" to distinguish them from a search on a particular field.

    c:startc:start=10Start with the Nth object within the results of the query
    c:limitc:limit=20Limit the results to at most N objects
    c:showc:show=field,field Only include the provided field(s) from the objects returned

    c:countc:count=1 Include the total count of the queried results; compare to the "limit" to see if the results have been constrained by a limit. The value is either 1 or 0 (default is 0, or "don't show").

    c:hidec:hide=field,field Show everything EXCEPT for the provided field(s) from the objects returned

    c:sortc:sort=field[:1,:-1],field Sort the results by the field(s) provided; sort order specified after a ":" using 1 for ascending and -1 for descending
    c:hasc:has=fieldOnly include objects where the specified field(s) exist, regardless of the value within that field
    c:resolve c:resolve=field,field"Resolve" information by merge data from another collection using provided field(s)
    c:attachments c:attachments=categoryInclude the attachments for the object for the given category(s) within an attachment_files element
    c:distinctc:distinct=fieldReturn the distinct values of a particular field.

    c:explain c:explain=1"Explain" the database logic that is used for the query to analyze performance
    NOTE: c:distinct may not have good performance on extremely large collections. It should *not* be used on the main character collection, for instance.

    To find out which fields may be used for a c:resolve, send a "collection query" to the API. That is a query that specifies the format and game, but not a collection. This will return the list of collections available for that game and the fields within each collection that can be resolved.


    This will include the name to use within the c:resolve command.

    The c:attachments category is game-specific. For EverQuest II, the valid categories are paperdoll, headshot, petpaperdoll. A special category is all, which will return the attachments for all known categories. It will cause an additional element, , to be included in the output. This will describe external files (usually an image) that can be used within that object with additional, useful metadata. One of the metadata fields is a fully qualified URL that can be used in your web site to embed the file(s) directly.
    Last edited by a moderator: Dec 14, 2016
  2. DanKinney

    DanKinney Guest

    Note...the brackes within the [:1] syntax indicates that this is optional.  The actual usage for sorting would be...

    This would use an ascending sort on field1.  A decending sort on field1 would look like...


  3. NeillM

    NeillM Guest

    c:hide seems to be mis described, it returns all but the fields stated.

    There does however seem to be an undocumented c:show which works to return only the specified fields and attributes

  4. DanKinney

    DanKinney Guest

    You are correct sir...my bad.  There is both a c:show (show only these fields) and a c:hide (show everything but these fields).

    I'll update the docs.


  5. NeillM

    NeillM Guest

    In the API changes you mentioned we can now use regular expressions, which regular expression syntax is being used? (i.e. POSIX, XML, Java ect)

  6. DanKinney

    DanKinney Guest

  7. NeillM

    NeillM Guest

    Thanks Dan

  8. Quicktiger

    Quicktiger Guest

    Could you provide an example usage of the c:resolve query command?

  9. Lantis

    Lantis Guest

    This resolves spell names:


  10. feldon30

    feldon30 Guest

    c:resolve is great for beastlord warders, items, etc.
  11. Stado

    Stado Guest

    I was hoping using ?c:resolve=achievements would show Heritage quests completed with an event count, desc, quota for the different Achievements from Heritage Quests.

    Is there a way to get Quest info?

    Or do i need to wait and hope for a:

    Collection name = Quests

  12. DanKinney

    DanKinney Guest

    Yes.  We have not added quest information just yet.  It's on my list of things to wrangle from the game team.


  13. ugglan

    ugglan Guest

    The c:resolve=spells not working anymore? I tested it and just got a full character xml.

  14. DanKinney

    DanKinney Guest

  15. Kulavvy

    Kulavvy Guest

    1. Can I filter resolved spells (for instance to get only those having level>80)?

    2. Can I exclude/hide whole elements (for instance "effect_list")?

    Kulavvy (Nagafen)

  16. Quicktiger

    Quicktiger Guest

    note that > 80 does not give a complete list of all spells/abilities a level 90 character should have.

    I did some (quite a lot actually) work on eq2mission.flame.org to properly track when a spell is replaced, and have the ability to say "for a level 90 Warden, what spells should I have?"

  17. DanKinney

    DanKinney Guest

    Not really.  The c:resolve only allows one to "show" fields from a resolve.  Filtering results within a c:resolve would be pretty difficult and complex.  We could add the ability to "hide" fields though...that would be pretty easy.

    For now, you would have to explicitly describe what you want to appear in the c:resolve.  Here is an example:


    You could chain these through multiple AJAX calls (or server logic) to perform this with multiple queries.


  18. Kulavvy

    Kulavvy Guest

    The primary goal for me was to minimize the amount of data retrieved from SOE service. By default:

    Character+equipmentSlots = ~120-130kBCharacter+equipmentSlots+spells = ~500-600kB (!)

    So filtering to ">80 spells" should limit the size to ~200kB, additionally giving more or less the level of masterization.While it's only for my guild purposes (for now), the results would be acceptable and cheap :cool:

    BTW: Dan's solution gives the Spells section limited to less than 40kB <img src="/station/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif" border="0" /> (thanks!)

  19. Kulavvy

    Kulavvy Guest

  20. feldon30

    feldon30 Guest

Share This Page