-
Notifications
You must be signed in to change notification settings - Fork 1
EVE API
Welcome to the EVE Wiki, the Chat-Bot API! This documentation should help you familiarise yourself with the resources available and how to consume them with HTTP requests. Read through the getting started section before you dive in. Most of your problems should be solved just by reading through it.
Feel free to suggest any changes or improvements. You can contact us via our email address ([email protected]).
Let's make our first API request to the EVE API! Open up a javascript file and use the jQuery $.ajax() function to perform an asynchronous HTTP request for a resource. In the example below, we're trying to get all Profile Images possible for a Bot:
URL
http://localhost:8080/getImages?sex=0
Example Request
$.ajax({
url: "http://localhost:8080/getImages?sex=0",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
Here is the response we get:
[
{"ImageID":26,"Gender":0,"Path":"/static/botimages/male001.png"},
{"ImageID":27,"Gender":0,"Path":"/static/botimages/male002.png"},
{"ImageID":28,"Gender":0,"Path":"/static/botimages/male003.png"},
{"ImageID":29,"Gender":0,"Path":"/static/botimages/male004.png"},
{"ImageID":30,"Gender":0,"Path":"/static/botimages/male005.png"},
{"ImageID":31,"Gender":0,"Path":"/static/botimages/male006.png"},
{"ImageID":32,"Gender":0,"Path":"/static/botimages/male007.png"},
{"ImageID":33,"Gender":0,"Path":"/static/botimages/male008.png"},
{"ImageID":41,"Gender":0,"Path":"/static/botimages/male016.png"},
{"ImageID":42,"Gender":0,"Path":"/static/botimages/male017.png"},
{"ImageID":43,"Gender":0,"Path":"/static/botimages/male018.png"},
]
If your response looks slightly different don't panic. This is probably because more data has been added to EVE API since we made this documentation.
EVE API is a completely open API. To ensure some safety aspects Basic Authentication is required to query and get data. Use your credentials that you entered during registration to authenticate yourself:
$.ajax({
url: "something",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
Another option is to authenticate via session cookie. See Login
Scroll down to find out how to register for EVE!
If you find a mistake in the data, then contact us.
All resources support JSON Schema. This will allow you to programmatically inspect the attributes of that resource and their types. JSON is easy to read and easy to write.
- POST User Registration
- POST Create a Bot
- GET a random name for the bot
- GET a random image for the bot
- GET all possible images
- GET Delete a bot
- POST Chat via Request
- Chat via Websocket
Our web API consists of several functions. An integral part of EVE is the creation of a bot. There you can select name, gender and a profile picture of the bot. But the most important part of EVE is the chat with the bot. With our EVE API, you can chat via a websocket or HTTP requests. But more later.
Let's start!
You can authenticate Users within your application to extend the EVE experience within your application. To chat with our EVE Bots you need to be authenticated.
Authentication
- Basic Authentication
URL
http://localhost:8080/createUser
Example Request
$.ajax({
url: "http://localhost:8080/createUser",
dataType: "json",
data : {
username : "Max Mustermann",
password : "secret_password"
},
type : "POST",
success : function(r) {
console.log(r);
}
});
URL Params
Required:
username=[string]
password=[string]
Authentication
- Basic Authentication
URL
http://localhost:8080/createBot
Example Request
$.ajax({
url: "http://localhost:8080/getImages?sex=0",
dataType: "json",
data : {
nameID : 1,
imageID : 10,
sex : 1
},
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
type : "POST",
success : function(r) {
console.log(r);
}
});
URL Params
Required:
nameID=[integer]
imageID=[integer]
sex=[integer]
A random name and image can be generated thorough "http eve.de/getRandomImage" and "http eve.de/getRandomName". For more information about these requests scroll down. Sex has to be either 0 (Man) or 1 (Woman).
Authentication
- Basic Authentication
URL
http://localhost:8080/deleteBot
Example Request
$.ajax({
url: "http://localhost:8080/deleteBot?bot=1",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
URL Params
Required:
bot=[integer]
Authentication
- Basic Authentication
URL
http://localhost:8080/getRandomImage
Example Request
$.ajax({
url: "http://localhost:8080/getRandomImage?sex=0",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
URL Params
Required:
sex=[integer]
Sex has to be either 0 (Man) or 1 (Woman).
Example Response:
{
"ImageID":14,
"Gender":1,
"Path":"/static/botimages/female014.png"
}
{
"ImageID":51,
"Gender":0,
"Path":"/static/botimages/male026.png"
}
Authentication
- Basic Authentication
URL
http://localhost:8080/getRandomName
Example Request
$.ajax({
url: "http://localhost:8080/getRandomName?sex=0",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
URL Params
Required:
sex=[integer]
Example Response:
{
"ID":495,
"Text":"Max",
"Gender":0
}
{
"ID":248,
"Text":"Lydia",
"Gender":1
}
Sex has to be either 0 (Man) or 1 (Woman).
Authentication
- Basic Authentication
URL
http://localhost:8080/getImages
Example Request
$.ajax({
url: "http://localhost:8080/getImages?sex=0",
dataType: "json",
type : "GET",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
URL Params
Required:
sex=[integer]
Example Response:
[
{"ImageID":26,"Gender":0,"Path":"/static/botimages/male001.png"},
{"ImageID":27,"Gender":0,"Path":"/static/botimages/male002.png"},
{"ImageID":28,"Gender":0,"Path":"/static/botimages/male003.png"},
{"ImageID":29,"Gender":0,"Path":"/static/botimages/male004.png"},
{"ImageID":30,"Gender":0,"Path":"/static/botimages/male005.png"},
{"ImageID":31,"Gender":0,"Path":"/static/botimages/male006.png"},
{"ImageID":32,"Gender":0,"Path":"/static/botimages/male007.png"},
{"ImageID":33,"Gender":0,"Path":"/static/botimages/male008.png"},
{"ImageID":41,"Gender":0,"Path":"/static/botimages/male016.png"},
{"ImageID":42,"Gender":0,"Path":"/static/botimages/male017.png"},
{"ImageID":43,"Gender":0,"Path":"/static/botimages/male018.png"},
]
Sex has to be either 0 (Man) or 1 (Woman).
There are two ways to send a message to our EVE Bot. Either via an HTTP request or via a WebSocket. We recommend using a WebSocket to ensure the best user experience.
If you are communicating with our EVE bots over HTTP requests, be careful to use the correct JSON format.
Authentication
- Basic Authentication
URL
http://localhost:8080/messageApi
Example Request
$.ajax({
url: "http://localhost:8080/createUser",
dataType: "json",
data : {
message : "Max Mustermann",
bot : "secret_password"
},
contentType: "application/json; charset=utf-8",
type : "POST",
headers: {
// most browsers do this automatically
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
},
success : function(r) {
console.log(r);
}
});
curl -H "Content-Type: application/json" -X POST -d '{"message":"here your message","bot":0}' http://localhost:8080/messageApi
URL Params
Required:
message=[string]
bot=[integer]
Example Response:
Was ist mit mir?
Authentication
- Basic Authentication / Session key (for Safari)
URL
http://localhost:8080/ws
Example
First we need to establish a WebSocket connection to the server:
var conn = new WebSocket("ws://" + document.location.host + "/ws");
Next we create a listener to read incomming messages from the server. The answers are sent as plain text.
conn.onmessage = function (evt) {
var messages = evt.data;
console.log(message);
// handle message
};
At last we send a message to the server via the WebSocket. Every request needs a message text and the id of the bot, which we want to send the message to.
var request = {
"message": "Test message",
"bot": botID
}
conn.send(JSON.stringify(request));
If everything works correct you should see the bot answer printed to the console.