
What's this?
This is a Go microservice to convert CX stream into other formats.
(TBD)
How to Run
1. In single API server mode
You can run this service as a single RESTful API server independent from Cytoscape CI.
On your local machine
Then access http://localhost:3000/
to check the server is actually working or not.
Docker Container
The easiest way to run this application is using Docker. Suppose you are using Docker host running on 192.168.99.100
.
Register to elsa
This service works in two modes:
Single server mode
If you run this service without elsa instance, it works as a simple RESTful API server. You can use your server by
directly send your POST requests to it.
CI service mode
If you have a running instance of elsa, the registration process is (semi) automatic. You can specify the following
command-line options to register the service to elsa.
(TBD)
Options
- id - ID of this service (e.g., idmapping)
- ver - version of this API (e.g., v1)
- port - Port number of this service
- agent - Location of elsa instance
How to use the service
REST API
/
- Function - Show service information
- Supported Methods - GET
- Output
{
}
/converter/cx2cyjs
- Function - Convert CX into Cytoscape.js
- Supported Methods - POST
Query
{
}
Sample Client Code in Python
import json, requests
SERVICE_URL = "http://192.168.99.100:3000/converter/cx2cyjs" # Replace this to your server location.
res = requests.post(SERVICE_URL, json=query)
print(res.json())
Errors
Invalid user data
If the query does not contain required parameters (for this version, ids is the only required field)
the service returns this error.
Unsupported Method
You will see this when you use unsupported HTTP method for an endpoint.
For example you need to use POST method to call this ID Mapping service, and you will get this error
when you simply call the URL with GET method.
Resource Not found
If the service cannot find any result, it returns this error.
Unexpected server side error
Usually this should not happen. In Go, if critical panic happens due to bugs, this will be returned to the user.
-
Code: 500
-
Body:
{
"code": 500,
"message": "Something wrong happened to the service. Now is the good time to call admin...",
"error": "(stack trace, panic message, heap dump, etc.)"
}