You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
 
 
 
 

63 lines
1.2 KiB

'use strict'
// ------------------- Create Agent -------------------
function createAgent(faction, symbol){
const data = {faction: faction, symbol: symbol}
const settings = {
async: true,
crossDomain: true,
url: 'https://api.spacetraders.io/v2/register',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
processData: false,
data: JSON.stringify(data)
};
$.ajax(settings).done(function (response) {
console.log(response.data);
return response.data;
});
}
$(document).ready(function() {
//Let agent = createAgent("COSMIC","agent_bryte");
})
// ------------------- Get Agent -------------------
// ------------------- List Agent (Leaderboard) -------------------
function listAgent(page, limit){
const settings = {
async: true,
crossDomain: true,
url: 'https://api.spacetraders.io/v2/agents',
method: 'GET',
headers: {
Accept: 'application/json'
},
data : {
page: page,
limit: limit
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
}
$(document).ready(function() {
let leaderboard = listAgent("374", "1");
})