-
Notifications
You must be signed in to change notification settings - Fork 94
API
The Prana API tends to be REST. In future we might add other wire protocols such as Protocol Buffers or Thrift.
GET /ping
Returns the health of the Prana application Example Request:
GET /ping HTTP/1.1
Example Response:
HTTP/1.1 200 OK
Content-Type: text/plain
OK
GET /dynamicproperties?(list of property names)
Given a list of property names, returns a JSON map of property values. If a property is not present, the value is null for that particular property.
Example Request:
GET /dynamicproperties?id=foo&id[1]=bar HTTP/1.1
Example Response:
HTTP/1.1 200 OK
Content-Type: application/json
{"foo": "pipe", "bar": "baz"}
GET/POST/PUT/DELETE /proxy?vip=(vip name of a service)&path=(path on the vip) HTTP/1.1
Prana uses the same http verb that is used while making a call to the /proxy endpoint in Ribbon and makes a call to the VIP on the given path. Ribbon continuously polls Eureka for hosts marked as UP and load balances all outgoing http requests among the available hosts with matching vip address.
Example Request:
POST /proxy?vip=MYAWESOMESERVICE&path=/createuser HTTP/1.1
Content-Type: application/json
{"state":"CA", "name":"Bob"}
Example Response:
HTTP/1.1 201 OK
Content-Type: application/json
{"id":"2121-212-2121"}
GET /eureka/hosts?appName=(application name)&vip=(VIP Name, this is optional)
Returns a list of hosts which are marked as UP in Eureka for the specific application and VIP passed as query parameters. If a VIP name is passed we filter the hosts matching that VIP name.
Example Request:
GET /eureka/hosts?appName=wonderapp HTTP/1.1
Example Response:
HTTP/1.1 200 OK
Content-Type: application/json
["hostname1", "hostname2", "hostname3"]
GET /healthcheck HTTP/1.1
Prana makes an http connection to the app on behalf it has to report health checks when the /healthcheck endpoint is requested.
The URL of the application running alongside Prana can be configured via a Dynamic Property, for example by passing a JVM configuration like "-Dprana.host.healthcheck.url=http://localhost:5050/status"
In case the user always wants to report healthy, the property should be explicitly set to an empty string. For exmample, "-Dprana.host.healthcheck.url="
Example Request:
GET /healthcheck HTTP/1.1
Example Response:
HTTP/1.1 200 OK
Content-Type: application/xml
<status>ok</status>