keiono / cy-rest

This site is obsolete! Please use the link here:
http://github.com/idekerlab/cyREST
MIT License
4 stars 1 forks source link

Add API for View objects #35

Closed keiono closed 10 years ago

keiono commented 10 years ago

Need to support RESTful operations for View objects. This is for setting/getting Visual Property values for the given view object.

keiono commented 10 years ago

This API should support batch update.

keiono commented 10 years ago

Draft of View Object API

For all Visual Property Values for a Graph Object

keiono commented 10 years ago

Here is the updated API:

Get Current Visual Property Values for a View Object

The return value looks like this:

[
    {
        "visualProperty": "NODE_WIDTH",
        "value": 40
     }, ..., {}
]

Directly Update View Object

And the BODY should have the following:

[
    {
        "SUID": 12345,
        "view": [
            {
                "visualProperty": "NODE_WIDTH",
                "value": 40
             }, ..., {}
        ]
    }, ... {}
]

With this API, users can update any Visual Property values for the view for multiple nodes/edges at once.

keiono commented 10 years ago

Query parameter has been added to selectively get Visual Property value from a view object.

For example, if you want to get node X position, use:

GET /networks/NET_SUID/views/VIEW_SUID/nodes?visualProperty=NODE_X_LOCATION

And this returns:

[ {
  "SUID" : 161,
  "view" : [ {
    "visualProperty" : "NODE_X_LOCATION",
    "value" : 42.974062556729564
  } ]
}, {
  "SUID" : 133,
  "view" : [ {
    "visualProperty" : "NODE_X_LOCATION",
    "value" : 296.2392603106358
  } ]
}, {
  "SUID" : 181,
  "view" : [ {
    "visualProperty" : "NODE_X_LOCATION",
    "value" : -343.0770086102626
  } ]
}, ...
]
jbethune commented 10 years ago

If we already have to provide a NODE_SUID or EDGE_SUID why do we also have to provide a SUID in the JSON payload?

    PUT /networks/NET_SUID/views/VIEW_SUID/nodes/NODE_SUID
    PUT /networks/NET_SUID/views/VIEW_SUID/edges/EDGE_SUID

and

[
    {
        "SUID": 12345,
        "view": [
            {
                "visualProperty": "NODE_WIDTH",
                "value": 40
             }, ..., {}
        ]
    }, ... {}
]

What does this SUID refer to?

And can you please regenerate the API documentation in HTML form with the new API endpoints?