py4cytoscape.commands.cyrest_put
-
cyrest_put
(operation=None, parameters=None, body=None, base_url='http://127.0.0.1:1234/v1', require_json=True)[source] Construct a query and body, make PUT call and process the result.
- Parameters
operation (str) – A string to be converted to the REST query namespace
parameters (dict) – A named list of values to be converted to REST query parameters
body (dict) – A named list of values to be converted to JSON
base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://127.0.0.1:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.
require_json (bool) – True if only JSON is accepted as a response; otherwise, return non-JSON if response is non-JSON
- Returns
a dict if result was JSON; otherwise a string
- Return type
str or dict
- Raises
ValueError – if JSON is expected and response is not JSON
requests.exceptions.RequestException – if can’t connect to Cytoscape or Cytoscape returns an error
Examples
>>> cyrest_put('networks/views/currentNetworkView', body={'networkViewSUID': view}) # Make a view the current view {'data': {}, 'errors': '[]}