Reputation: 139
The API I am trying query from is: https://socket.etherdelta.com
Documentation for the API here:https://github.com/etherdelta/etherdelta.github.io/blob/master/docs/API.md
When I try to to do a simple get request: https://socket.etherdelta.com/getmarkets it gives me an error message saying "Cannot GET /getmarkets"
This is the code I am trying to use to get market information:
var request = require('request');
var url = 'https://socket.etherdelta.com/getMarket';
request(url , (err, res, body) => {
try{
var json = JSON.parse(body);
console.log(json);
}catch(err){
console.log('parsing error');
console.log(body);
}
});
edited it to this:
var WebSocket = require('ws')
var ws = new WebSocket('wss://socket.etherdelta.com')
ws.onopen = function(){
ws.send(JSON.stringify("getMarket"))
};
ws.onmessage = function(msg){
var response = JSON.parse(msg.data);
console.log(response);
};
Upvotes: 0
Views: 1471
Reputation: 1046
It seems like this API operates on WSS protocol rather than HTTPS. Could you please try a web socket client library like ws with below URL
wss://socket.etherdelta.com
Upvotes: 1