bildwelt
E2E FORUM
E2E Bridge E2E Commerce

RESTful HTTP Service & Persistent State Objects

E2E Forum Modeling & Development RESTful HTTP Service & Persistent State Objects

This topic contains 4 replies, has 2 voices, and was last updated by  Cliff Faurer 3 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #779

    Cliff Faurer
    Participant

    Hello,

    Do you have a more robust example that illustrates how to handle resource queries for a RESTful API using persistent state objects? The two issues I’ve run into are parsing the path parameters and then formulating the query for the persistent state objects.

    Here’s the type of query that needs to be handled: curl -X GET -G “http://localhost:12007/ticket/status,description?status=Submitted&creationDate.gt=2013-05-01”

    Thanks,

    Cliff

     

    #780

    Marcel R.
    Blocked

    Hi Cliff,

    I’m not sure whether I understand your issue correctly. Do you have problems getting the query parameters, such as status? If so, these parameters are found in the getParameters parameter (see http://docu.e2ebridge.com/HTTP+Service or http://docu.e2ebridge.com/Plain+HTTP+Service).

    Or do you face another issue altogether?

    Regards,

    Marcel

    #793

    Cliff Faurer
    Participant

    Hi Marcel,

    The question is not so much on parsing the parameters but rather what is the recommended way to model handling a query that involves date types with gt, gte, lt, lte? And how to handle attribute filtering?

    The Persistent State Adapter identifierCondition requires an explicit logical date expression. How to handle a RESTful request like the following:

    curl -X GET -G “http://localhost:12007/ticket?status=Submitted&creationDate.gt=2014-02-04T21:08:00.889767Z&creationDate.lte=2014-02-04T21:10:10.889767Z”

    The ticket resource has several date field that can be queried in this way; creationDate, targetResolutionDate, statusChangeDate and resolutionDate.

    The second question is about how to filter the returned attributes for a request like the following:

    curl -X GET -G “http://localhost:12007/ticket?fields=status,description&status=Submitted”

    Only the status and descriptions fields for every created ticket should be returned.

    Thanks,

    Cliff

    #794

    Marcel R.
    Blocked

    Hi Cliff,

    unfortunately, you cannot build state queries dynamically today. In theory it is possible to query the state database directly by using SQL, but we don’t recommend it. One reason is, that we might change the DB schema. Another reason is, that it is not completely trivial to build queries for search keys because we store them in an EAV table.

    Regarding your second question: we don’t support filtering of persistent state attributes either.

    All things considered, I would store your ticket resource in a relational database. Then, your requirements are easily implemented.

    Regards,

    Marcel

    #795

    Cliff Faurer
    Participant

    Hi Marcel,

    That’s too bad on both fronts. The persistent state modeling pattern works very well for the TMF RESTful APIs that I’m working to implement using the E2E Builder.

    Being able to dynamically build queries for the PersistentStateAdapter would be make handling types like date much easier. It seems it would be pretty straightforward to build the query as a string using ActionScript and then to pass that query string into the PersistentStateAdapter.

    Reverting to using a relational database to manage the tickets would make it easier to filter attributes but would lose the state machine features of the persistent state modeling pattern.

    Both of these requirements are typical of a RESTful API pattern, sure would be nice if they were supported by the persistent state adapter.

    Thanks,

    Cliff

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.