public async Task<string> GetEquipments()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "placeTokenHere");
var response = await client.GetAsync("https://developer.janes.com/api/v1/data/equipment").ConfigureAwait(false);
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return result;
}
public async Task<string> GetNews()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "placeTokenHere");
var response = await client.GetAsync("https://developer.janes.com/api/v1/News").ConfigureAwait(false);
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return result;
}
public async Task<string> GetNewsById(string id)
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "placeTokenHere");
var response = await client.GetAsync("https://ddeveloper.janes.com/api/v1/News/" + id).ConfigureAwait(false);
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
return result;
}
public String GetEquipments()
{
URL url = new URL("https://developer.janes.com/api/v1/data/equipment");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "placeTokenHere");
conn.setDoOutput(true);
conn.setRequestProperty("Accept", "application/json");
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
{
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
conn.disconnect();
return response.toString();
}
}
public String GetNews()
{
URL url = new URL("https://developer.janes.com/api/v1/News");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "placeTokenHere");
conn.setDoOutput(true);
conn.setRequestProperty("Accept", "application/json");
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
{
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
conn.disconnect();
return response.toString();
}
}
public String GetNews(string id)
{
URL url = new URL("https://developer.janes.com/api/v1/News/" + id);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "placeTokenHere");
conn.setDoOutput(true);
conn.setRequestProperty("Accept", "application/json");
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
{
String line;
StringBuilder response = new StringBuilder();
while ((line = in.readLine()) != null) {
response.append(line);
}
conn.disconnect();
return response.toString();
}
}
import requests
r = requests.get("https://developer.janes.com/api/v1/data/equipment", headers = {"Authorization" : "placeTokenHere"})
data = r.json();
import requests
r = requests.get("https://developer.janes.com/api/v1/News", headers = {"Authorization" : "placeTokenHere"})
data = r.json();
import requests
r = requests.get("https://developer.janes.com/api/v1/News/" + id, headers = {"Authorization" : "placeTokenHere"})
data = r.json();
const express = require("express");
const app = express();
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var xhr = new XMLHttpRequest();
app.get("/equipment", (req, res) => {
xhr.open('GET', 'https://developer.janes.com/api/v1/data/equipment');
xhr.setRequestHeader('Authorization', "placeTokenHere");
xhr.onload = function () {
if (xhr.status === 200) {
res.send(xhr.responseText);
} else if (xhr.status !== 200) {
res.send('Request failed. Returned status of ' + xhr.status);
}
};
xhr.send();
});
app.listen(7009);
const express = require("express");
const app = express();
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var xhr = new XMLHttpRequest();
app.get("/equipment", (req, res) => {
xhr.open('GET', 'https://developer.janes.com/api/v1/News');
xhr.setRequestHeader('Authorization', "placeTokenHere");
xhr.onload = function () {
if (xhr.status === 200) {
res.send(xhr.responseText);
} else if (xhr.status !== 200) {
res.send('Request failed. Returned status of ' + xhr.status);
}
};
xhr.send();
});
app.listen(7009);
const express = require("express");
const app = express();
var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
var xhr = new XMLHttpRequest();
app.get("/equipment", (req, res) => {
xhr.open('GET', 'https://developer.janes.com/api/v1/News/' + id);
xhr.setRequestHeader('Authorization', "placeTokenHere");
xhr.onload = function () {
if (xhr.status === 200) {
res.send(xhr.responseText);
} else if (xhr.status !== 200) {
res.send('Request failed. Returned status of ' + xhr.status);
}
};
xhr.send();
});
app.listen(7009);