Token
This token gives you access to the specific endpoints for which you subscribed
"contact_us_to_request_your_token"
Example
import requests
# A user is granted a token, such as:
token = "contact_us_to_request_your_token"
# This token gives you access to the specific endpoints for which you subscribed
headers = {'Authorization': 'Bearer ' + token}
url = "http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45"
response = requests.get (url, headers=headers)
curl -H "Authorization: Bearer contact_us_to_request_your_token" \
"http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45"
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ApiRequest {
public static void main(String[] args) {
String token = "contact_us_to_request_your_token";
String urlString = "http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45";
try {
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer " + token);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
// Print result
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) {
size_t total_size = size * nmemb;
strncat(userp, contents, total_size);
return total_size;
}
int main(void) {
CURL *curl;
CURLcode res;
char token[] = "contact_us_to_request_your_token";
char url[] = "http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45";
char response[10000] = {0}; // Buffer for the response
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer contact_us_to_request_your_token");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, response);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
} else {
printf("Response: %s\n", response);
}
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
}
curl_global_cleanup();
return 0;
}
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
int main() {
CURL *curl;
CURLcode res;
std::string readBuffer;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer contact_us_to_request_your_token");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
std::cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << std::endl;
} else {
std::cout << readBuffer << std::endl;
}
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
}
curl_global_cleanup();
return 0;
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer contact_us_to_request_your_token");
string url = "http://www.genify.ai/api/v1.0/txn-data/?description=starbucks&amount=45";
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
else
{
Console.WriteLine($"Error: {response.StatusCode}");
}
}
}
}