Skip to main content

API - Get All Assets

code repository

To help you get started with the iWantFuel API quickly and confidently, we’ve created plug-and-play code samples across all major programming languages and libraries.

Whether you're building in PHP, Python, JavaScript, Java, or beyond, these examples are designed to simplify your development process.

At iWantFuel, our mission is to help you unlock the full power of our platform—while keeping integration seamless, secure, and developer-friendly.

Available Code Samples Include:

  • C# – HttpClient, RestSharp
  • cURL
  • Dart – dio, http
  • Go – Native
  • HTTP (raw)
  • Java – OkHttp, Unirest
  • JavaScript – Fetch, jQuery, XHR
  • Kotlin – OkHttp
  • C – libcurl
  • Node.js – Axios, Native, Request, Unirest
  • Objective-C – NSURLSession
  • OCaml – Cohttp
  • PHP – cURL, Guzzle, HTTP_Request2, pecl_http
  • PowerShell – Invoke-RestMethod
  • Python – http.client, Requests
  • R – httr, RCurl
  • Ruby – Net::HTTP, reqwest, Httpie
  • Shell – wget
  • Swift – URLSession

Start integrating with confidence—and bring seamless driver management to your platform today.

Payload

{
  "i_wallet": "IWF3-XXXX-XXXX"
}

Sample Response

{
    "Assets": [
        {
            "id": 35,
            "reg_number": "NURXXXXX",
            "vehicle_make": "Toyota",
            "asset_model": "Fortuner",
            "year_model": "2014",
            "fuel_type": "Diesel 50 ppm",
            "fuel_tank_size": "80",
            "Latest_ODO": "0",
            "tracking": "None",
            "MiX_Asset_ID": ""
        },

C# - HttpClient

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://www.iwantfuel.tech/api/get-assets.php");
request.Headers.Add("X-API-KEY", "API KEY HERE");
request.Headers.Add("X-SECRET-KEY", "SECRET KEY HERE");
var content = new StringContent("{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

C# - RestSharp

var options = new RestClientOptions("https://www.iwantfuel.tech")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/get-assets.php", Method.Get);
request.AddHeader("X-API-KEY", "API KEY HERE");
request.AddHeader("X-SECRET-KEY", "SECRET KEY HERE");
request.AddHeader("Content-Type", "text/plain");
var body = @"{
" + "\n" +
@"  ""i_wallet"": ""IWF3-XXXX-XXXX""
" + "\n" +
@"}";
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

cURL

curl --location --request GET 'https://www.iwantfuel.tech/api/get-assets.php' \
--header 'X-API-KEY: API KEY HERE' \
--header 'X-SECRET-KEY: SECRET KEY HERE' \
--header 'Content-Type: text/plain' \
--data '{
  "i_wallet": "IWF3-XXXX-XXXX"
}'

Dart - dio

var headers = {
  'X-API-KEY': 'API KEY HERE',
  'X-SECRET-KEY': 'SECRET KEY HERE',
  'Content-Type': 'text/plain'
};
var data = '''{\r\n  "i_wallet": "IWF3-XXXX-XXXX"\r\n}''';
var dio = Dio();
var response = await dio.request(
  'https://www.iwantfuel.tech/api/get-assets.php',
  options: Options(
    method: 'GET',
    headers: headers,
  ),
  data: data,
);

if (response.statusCode == 200) {
  print(json.encode(response.data));
}
else {
  print(response.statusMessage);
}

Dart - http

var headers = {
  'X-API-KEY': 'API KEY HERE',
  'X-SECRET-KEY': 'SECRET KEY HERE',
  'Content-Type': 'text/plain'
};
var request = http.Request('GET', Uri.parse('https://www.iwantfuel.tech/api/get-assets.php'));
request.body = '''{\r\n  "i_wallet": "IWF3-XXXX-XXXX"\r\n}''';
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
  print(await response.stream.bytesToString());
}
else {
  print(response.reasonPhrase);
}

Go - Native

package main

import (
  "fmt"
  "strings"
  "net/http"
  "io"
)

func main() {

  url := "https://www.iwantfuel.tech/api/get-assets.php"
  method := "GET"

  payload := strings.NewReader(`{`+"
"+`
  "i_wallet": "IWF3-XXXX-XXXX"`+"
"+`
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-KEY", "API KEY HERE")
  req.Header.Add("X-SECRET-KEY", "SECRET KEY HERE")
  req.Header.Add("Content-Type", "text/plain")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}

HTTP

GET /api/get-assets.php HTTP/1.1
Host: www.iwantfuel.tech
X-API-KEY: API KEY HERE
X-SECRET-KEY: SECRET KEY HERE
Content-Type: text/plain
Content-Length: 36

{
  "i_wallet": "IWF3-XXXX-XXXX"
}

Java - OkHttp

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}");
Request request = new Request.Builder()
  .url("https://www.iwantfuel.tech/api/get-assets.php")
  .method("GET", body)
  .addHeader("X-API-KEY", "API KEY HERE")
  .addHeader("X-SECRET-KEY", "SECRET KEY HERE")
  .addHeader("Content-Type", "text/plain")
  .build();
Response response = client.newCall(request).execute();

Java - Unirest

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://www.iwantfuel.tech/api/get-assets.php")
  .header("X-API-KEY", "API KEY HERE")
  .header("X-SECRET-KEY", "SECRET KEY HERE")
  .header("Content-Type", "text/plain")
  .body("{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}")
  .asString();

JavaScript - Fetch

const myHeaders = new Headers();
myHeaders.append("X-API-KEY", "API KEY HERE");
myHeaders.append("X-SECRET-KEY", "SECRET KEY HERE");
myHeaders.append("Content-Type", "text/plain");

const raw = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}";

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("https://www.iwantfuel.tech/api/get-assets.php", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

JavaScript - jQuery

var settings = {
  "url": "https://www.iwantfuel.tech/api/get-assets.php",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "X-API-KEY": "API KEY HERE",
    "X-SECRET-KEY": "SECRET KEY HERE",
    "Content-Type": "text/plain"
  },
  "data": "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}",
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

JavaScript - XHR

// WARNING: For GET requests, body is set to null by browsers.
var data = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://www.iwantfuel.tech/api/get-assets.php");
xhr.setRequestHeader("X-API-KEY", "API KEY HERE");
xhr.setRequestHeader("X-SECRET-KEY", "SECRET KEY HERE");
xhr.setRequestHeader("Content-Type", "text/plain");

xhr.send(data);

Kotlin - Okhttp

val client = OkHttpClient()
val request = Request.Builder()
  .url("https://www.iwantfuel.tech/api/get-assets.php")
  .addHeader("X-API-KEY", "API KEY HERE")
  .addHeader("X-SECRET-KEY", "SECRET KEY HERE")
  .addHeader("Content-Type", "text/plain")
  .build()
val response = client.newCall(request).execute()

C - libcurl

CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
  curl_easy_setopt(curl, CURLOPT_URL, "https://www.iwantfuel.tech/api/get-assets.php");
  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
  curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
  struct curl_slist *headers = NULL;
  headers = curl_slist_append(headers, "X-API-KEY: API KEY HERE");
  headers = curl_slist_append(headers, "X-SECRET-KEY: SECRET KEY HERE");
  headers = curl_slist_append(headers, "Content-Type: text/plain");
  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
  const char *data = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}";
  curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
  res = curl_easy_perform(curl);
  curl_slist_free_all(headers);
}
curl_easy_cleanup(curl);

NodeJs - Axios

const axios = require('axios');
let data = '{\r\n  "i_wallet": "IWF3-XXXX-XXXX"\r\n}';

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://www.iwantfuel.tech/api/get-assets.php',
  headers: { 
    'X-API-KEY': 'API KEY HERE', 
    'X-SECRET-KEY': 'SECRET KEY HERE', 
    'Content-Type': 'text/plain'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

NodeJs - Native

var https = require('follow-redirects').https;
var fs = require('fs');

var options = {
  'method': 'GET',
  'hostname': 'www.iwantfuel.tech',
  'path': '/api/get-assets.php',
  'headers': {
    'X-API-KEY': 'API KEY HERE',
    'X-SECRET-KEY': 'SECRET KEY HERE',
    'Content-Type': 'text/plain'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}";

req.write(postData);

req.end();

NodeJs - Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://www.iwantfuel.tech/api/get-assets.php',
  'headers': {
    'X-API-KEY': 'API KEY HERE',
    'X-SECRET-KEY': 'SECRET KEY HERE',
    'Content-Type': 'text/plain'
  },
  body: '{\r\n  "i_wallet": "IWF3-XXXX-XXXX"\r\n}'

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

NodeJs - Unirest

var unirest = require('unirest');
var req = unirest('GET', 'https://www.iwantfuel.tech/api/get-assets.php')
  .headers({
    'X-API-KEY': 'API KEY HERE',
    'X-SECRET-KEY': 'SECRET KEY HERE',
    'Content-Type': 'text/plain'
  })
  .send("{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}")
  .end(function (res) { 
    if (res.error) throw new Error(res.error); 
    console.log(res.raw_body);
  });

Objective-C - NSURLSession

#import <Foundation/Foundation.h>

dispatch_semaphore_t sema = dispatch_semaphore_create(0);

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://www.iwantfuel.tech/api/get-assets.php"]
  cachePolicy:NSURLRequestUseProtocolCachePolicy
  timeoutInterval:10.0];
NSDictionary *headers = @{
  @"X-API-KEY": @"API KEY HERE",
  @"X-SECRET-KEY": @"SECRET KEY HERE",
  @"Content-Type": @"text/plain"
};

[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];

[request setHTTPMethod:@"GET"];

NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
  if (error) {
    NSLog(@"%@", error);
    dispatch_semaphore_signal(sema);
  } else {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSError *parseError = nil;
    NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
    NSLog(@"%@",responseDictionary);
    dispatch_semaphore_signal(sema);
  }
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);

OCaml - Cohttp

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://www.iwantfuel.tech/api/get-assets.php',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS =>'{
  "i_wallet": "IWF3-XXXX-XXXX"
}',
  CURLOPT_HTTPHEADER => array(
    'X-API-KEY: API KEY HERE',
    'X-SECRET-KEY: SECRET KEY HERE',
    'Content-Type: text/plain'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

PHP - cURL

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://www.iwantfuel.tech/api/add_driver.php',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
  "first_name": "John",
  "last_name": "Doe",
  "Mobile_Number": "0821234567",
  "dialing_code": "+27",
  "int_num": "+27",
  "active": "Yes"
}',
  CURLOPT_HTTPHEADER => array(
    'X-API-Key: Enter Your API Key Here',
    'X-Secret-Key: Enter Your Secret Key Here',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

PHP - Guzzle

<?php
$client = new Client();
$headers = [
  'X-API-KEY' => 'API KEY HERE',
  'X-SECRET-KEY' => 'SECRET KEY HERE',
  'Content-Type' => 'text/plain'
];
$body = '{
  "i_wallet": "IWF3-XXXX-XXXX"
}';
$request = new Request('GET', 'https://www.iwantfuel.tech/api/get-assets.php', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

PHP - HTTP_Request2

<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://www.iwantfuel.tech/api/get-assets.php');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
  'follow_redirects' => TRUE
));
$request->setHeader(array(
  'X-API-KEY' => 'API KEY HERE',
  'X-SECRET-KEY' => 'SECRET KEY HERE',
  'Content-Type' => 'text/plain'
));
$request->setBody('{
\n  "i_wallet": "IWF3-XXXX-XXXX"
\n}');
try {
  $response = $request->send();
  if ($response->getStatus() == 200) {
    echo $response->getBody();
  }
  else {
    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
    $response->getReasonPhrase();
  }
}
catch(HTTP_Request2_Exception $e) {
  echo 'Error: ' . $e->getMessage();
}

PHP - pecl_http

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://www.iwantfuel.tech/api/get-assets.php');
$request->setRequestMethod('GET');
$body = new http\Message\Body;
$body->append('{
  "i_wallet": "IWF3-XXXX-XXXX"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'X-API-KEY' => 'API KEY HERE',
  'X-SECRET-KEY' => 'SECRET KEY HERE',
  'Content-Type' => 'text/plain'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

PowerShell - RestMethod

$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("X-API-KEY", "API KEY HERE")
$headers.Add("X-SECRET-KEY", "SECRET KEY HERE")
$headers.Add("Content-Type", "text/plain")

$body = @"
{
  `"i_wallet`": `"IWF3-XXXX-XXXX`"
}
"@

$response = Invoke-RestMethod 'https://www.iwantfuel.tech/api/get-assets.php' -Method 'GET' -Headers $headers -Body $body
$response | ConvertTo-Json

Python - http.client

import http.client

conn = http.client.HTTPSConnection("www.iwantfuel.tech")
payload = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"
headers = {
  'X-API-KEY': 'API KEY HERE',
  'X-SECRET-KEY': 'SECRET KEY HERE',
  'Content-Type': 'text/plain'
}
conn.request("GET", "/api/get-assets.php", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Python - Requests

import requests

url = "https://www.iwantfuel.tech/api/get-assets.php"

payload = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"
headers = {
  'X-API-KEY': 'API KEY HERE',
  'X-SECRET-KEY': 'SECRET KEY HERE',
  'Content-Type': 'text/plain'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

R - httr

library(httr)

headers = c(
  'X-API-KEY' = 'API KEY HERE',
  'X-SECRET-KEY' = 'SECRET KEY HERE',
  'Content-Type' = 'text/plain'
)

body = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"

res <- VERB("GET", url = "https://www.iwantfuel.tech/api/get-assets.php", body = body, add_headers(headers))

cat(content(res, 'text'))

R - RCurl

library(RCurl)
headers = c(
  "X-API-KEY" = "API KEY HERE",
  "X-SECRET-KEY" = "SECRET KEY HERE",
  "Content-Type" = "text/plain"
)
params = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"
res <- getURL("https://www.iwantfuel.tech/api/get-assets.php", .opts=list(httpheader = headers, followlocation = TRUE))
cat(res)

Ruby - Net::HTTP

require "uri"
require "net/http"

url = URI("https://www.iwantfuel.tech/api/get-assets.php")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = "API KEY HERE"
request["X-SECRET-KEY"] = "SECRET KEY HERE"
request["Content-Type"] = "text/plain"
request.body = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"

response = https.request(request)
puts response.read_body

Ruby - reqwest

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder()
        .build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert("X-API-KEY", "API KEY HERE".parse()?);
    headers.insert("X-SECRET-KEY", "SECRET KEY HERE".parse()?);
    headers.insert("Content-Type", "text/plain".parse()?);

    let data = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}";

    let request = client.request(reqwest::Method::GET, "https://www.iwantfuel.tech/api/get-assets.php")
        .headers(headers)
        .body(data);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}

Ruby - Httpie

printf '{
  "i_wallet": "IWF3-XXXX-XXXX"
}'| http  --follow --timeout 3600 GET 'https://www.iwantfuel.tech/api/get-assets.php' \
 X-API-KEY:'API KEY HERE' \
 X-SECRET-KEY:'SECRET KEY HERE' \
 Content-Type:'text/plain'

Shell - wget

wget --no-check-certificate --quiet \
  --method GET \
  --timeout=0 \
  --header 'X-API-KEY: API KEY HERE' \
  --header 'X-SECRET-KEY: SECRET KEY HERE' \
  --header 'Content-Type: text/plain' \
  --body-data '{
  "i_wallet": "IWF3-XXXX-XXXX"
}' \
   'https://www.iwantfuel.tech/api/get-assets.php'

Swift - URLSession

let parameters = "{\r\n  \"i_wallet\": \"IWF3-XXXX-XXXX\"\r\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https://www.iwantfuel.tech/api/get-assets.php")!,timeoutInterval: Double.infinity)
request.addValue("API KEY HERE", forHTTPHeaderField: "X-API-KEY")
request.addValue("SECRET KEY HERE", forHTTPHeaderField: "X-SECRET-KEY")
request.addValue("text/plain", forHTTPHeaderField: "Content-Type")

request.httpMethod = "GET"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()