Skip to content
keiono edited this page Oct 1, 2014 · 3 revisions

Examples

The design principle of this REST API is simple: make programmer-friendly, easy-to-use API for advanced users. These days, almost all popular web services including Google, Twitter, and Facebook have REST API. They are following basic RESTful API design principles and once you learn one of them, it is relatively easy to learn others because they simply map their operations on data objects to basic HTTP operations, which are Create (POST), Read (GET), Update (PUT), and Delete (DELETE).

Cytoscape RESTful API module is following this design principle. Operations on Cytoscape objects are mapped to CRUD.

Examples as Raw URLs

Get data from Cytoscape (GET)

  • Get all networks as JSON

GET http://localhost:1234/v1/networks


* Get Visual Style named _Directed_ as JSON

GET http://localhost:1234/v1/styles/Directed


* Get Visual Style named _Directed_ as JSON

GET http://localhost:1234/v1/styles/Directed




* Apply _force-directed_ layout to network with SUID 53

GET http://localhost:1234/v1/apply/layouts/force-directed/53



#### Create new objects in Cytoscape
* Send network and its table as JSON

Network to be sent:
```JSON
{
    "data": {
          "name": "my network 1"
    },
    "elements": {
          "nodes":[...],
          "edges":[...]
    }
}
POST http://localhost:1234/v1/networks

Update existing data

  • Add new nodes to existing network with SUID 52

PUT http://localhost:1234/v1/networks/52


#### Delete existing objects
* Delete all networks in current session

DELETE http://localhost:1234/v1/networks


* Delete a network with SUID 52

DELETE http://localhost:1234/v1/networks/52


* Delete a node with SUID 1200

DELETE http://localhost:1234/v1/networks/52/nodes/1200



## Complete API Documentation
* [Cytoscpae REST API v1 documentation](REST-API-Document-V1)
Clone this wiki locally