Menu

run OQL by its ID via REST/JSON service

2017-04-24
2017-04-24
  • Dennis Moroney

    Dennis Moroney - 2017-04-24

    this will get me the name and expression of OQL #6
    {
    "operation": "core/get",
    "class": "QueryOQL",
    "key": 6,
    "output_fields": "friendlyname, oql
    }

    I want to run the OQL via the REST API. Does anyone have a solution?

     
  • Dennis Moroney

    Dennis Moroney - 2017-04-24

    correction. I want to run the OQL by its ID via REST/JSON

     
  • Vincent @ Combodo

    According to the Rest/Json documentation, what you are willing to do is not supported.
    QueryOQL can returned a combinaison of objects from different classes while the REST API only propose to search objects from a single class (might be an abstract class, resulting in objects from multiple final classes, but limited to fields of the abstract class).

    I have not tested what would be the result of an API search like this:

    {
       "operation": "core/get",
       "class": "Person",
       "key": "SELECT Team, Person FROM Team JOIN lnkPersonToTeam AS l ON l.team_id=Team.id JOIN Person ON l.person_id=Person.id WHERE email LIKE '%.com'",
       "output_fields": "Person.friendlyname, Team.email"
     }
    

    You can try. If it does not work, then no solution.
    Also if your QueryOQL is only getting one class of object, then it's always possible to get the results, you need to parse the OQL to get the class name, as it's not an attribute, then use the above search, with class (=unique class requested by the QueryOQL) and key (=the content of the OQL).

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.