Set up access tokens
Guidelines for including the access token fetched from the authentication page in the request.
const axios = require('axios');
const ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN_HERE';
const REQUEST_PATH = 'ANY_PATH';
const headers = {
'EXCOINZ_SECRET': `${SECRET_KEY}`,
'Authorization': `Bearer ${ACCESS_TOKEN}`,
'Content-Type': 'application/json'
};
const data = {
//ANY_DATA
};
axios.post(`https://api.excoinz.com/${REQUEST_PATH}`, data, { headers: headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error.response.data);
});
import okhttp3.*;
import java.io.IOException;
public class ExcoinzRequest {
public static void main(String[] args) {
String url = "https://api.excoinz.com/${ANY_PATH}";
String ACCESS_TOKEN = "YOUR_ACCESS_TOKEN_HERE";
String SECRET_KEY = "YOUR_SECRET_KEY";
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(
MediaType.parse("application/json"),
"{}"
);
Request request = new Request.Builder()
.url(url)
.post(body)
.addHeader("Content-Type", SECRET_KEY)
.addHeader("Authorization", "Bearer " + ACCESS_TOKEN)
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
}
}
<?php
$SECRET_KEY = 'YOUR_SECRET_KEY';
$url = "https://api.excoinz.com/${ANY_PATH}";
$ACCESS_TOKEN = "YOUR_ACCESS_TOKEN_HERE";
$data = json_encode(array(
));
$headers = array(
"EXCOINZ_SECRET: $SECRET_KEY",
"Authorization: Bearer $ACCESS_TOKEN",
"Content-Type: application/json"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
If you don't include an access token in the request, the user will have to log in anew each time.
Last updated