iWantFuel 3rd party Ordering API
Seamless Fuel Ordering for the Digital Era
Executive Summary
iWantFuel has redefined how businesses manage refuelling. With the release of our powerful new Fuel Ordering API, clients can now initiate and manage fuel purchases directly from third-party software, whether that’s a fleet management system, telematics platform, ERP, or custom-built application.
Our API supports integration across more than 20 development environments and languages, making fuel transactions faster, more secure, and fully automated.
This is not just an API, it’s the future of smart refuelling.
Why iWantFuel API?
Traditional refuelling methods are plagued by inefficiencies, delays, and fraud risk. Businesses rely on manual processes, fuel cards, and paper trails that are outdated and unreliable.
With the iWantFuel API, we solve these issues by enabling:
- Real-time fuel orders from your existing software.
- Geolocation-driven site selection based on price or proximity.
- Automated driver and vehicle validation for complete control.
- Upfront payment enforcement, eliminating credit risk.
- Cross-platform compatibility with over 20 languages and libraries.
Core Use Cases
| Use Case | Benefit |
|---|---|
| Fleet Management Integration | Automatically trigger fuel orders based on vehicle location, tank level, or route—no manual input needed. |
| ERP & Accounting Systems | Seamlessly sync fuel orders and costs in real time, ensuring accurate and up-to-date financial records. |
| Logistics Platforms | Enable dispatchers to place fuel orders directly within their workflow—no switching systems. |
| Mobile Apps | Let drivers refuel effortlessly with no cards, no cash, and no admin—just tap and go. |
Supported Technologies
Our RESTful API is compatible with the most widely used platforms and libraries, including:
- Languages: C#, Java, JavaScript, PHP, Python, Go, Ruby, Swift, Kotlin, Objective-C, R, OCaml, Dart
- Protocols & Tools: cURL, HTTP (raw), PowerShell, Shell (wget)
- Frameworks: RestSharp, Fetch, Axios, URLSession, Guzzle, Requests, libcurl, Unirest, Dio, XHR
This ensures that any developer, anywhere, can implement the iWantFuel API in minutes.
Sample Payload
{
"Asset_Reg": "CFM81479",
"Driver_Mobile": "0711425972",
"Asset_Latitude": "-33.90867357575131",
"Asset_Longitude": "18.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "100"
}
This payload lets the API intelligently determine the most suitable refuelling site (based on live pricing and distance), verify the driver and vehicle, and initiate a secure transaction instantly.
Payload Criteria & Validation
To ensure seamless processing and eliminate errors or fraud, the iWantFuel API enforces strict validation on the payload. Each field plays a critical role in determining eligibility, location matching, and transaction routing.
Here’s a breakdown of the required fields and their purpose:
| Field | Requirement | Description |
|---|---|---|
| Asset_Reg | Must be loaded under client profile | The vehicle registration must exist on the client's account. |
| Driver_Mobile | Must be loaded under client profile | The mobile number must belong to an authorized driver in the client's profile. |
| Asset_Latitude & Asset_Longitude | Required | Determines the nearest or most cost-effective refuelling site. These must be accurate GPS coordinates. |
| Fill_Type | Must be one of: Exact Quantity, Exact Currency, or Fill up | Specifies how the fuel quantity or cost should be calculated. |
| Best_Site_Price_Threshold_KM | Required | Sets the maximum travel radius (in km) the asset is allowed to move for refuelling at the best price. |
| Cheapest_or_Closest | Must be either: Cheapest or Closest | Defines whether the system should prioritize cost savings or minimal travel distance. |
| internal_order_number | Optional | Can be used to pass through a reference from your internal ERP, TMS, or finance system. |
| Total_Litres_or_Currency | Required | The max amount (in litres or currency) the system should allocate. If Fill up is selected, it will cap based on the asset’s registered tank size. |
If any of these fields are missing or invalid, the API will return a clear error message with an HTTP 422 status, helping integrators correct the issue quickly.
Security, Authentication and API Access Control
To protect the integrity of the iWantFuel platform, its fuel network, and its clients, the iWantFuel API is protected by strict access control and security policies.
All API endpoints are protected using API Key and Secret Key authentication. Clients are issued unique credentials to ensure secure and isolated usage of the platform. These credentials must be kept confidential and may not be shared with any third party.
iWantFuel maintains an internal blacklist of websites, platforms, and fleet management systems that are not permitted to access or integrate with the iWantFuel API.
API access may be denied, restricted, or revoked at any time if a system, organisation, or integration partner is found to:
-
Compete directly with the iWantFuel platform.
-
Attempt to replicate, reverse engineer, or copy iWantFuel functionality.
-
Misuse API endpoints or transaction flows.
-
Attempt to bypass iWantFuel security, pricing, or transaction controls.
-
Distribute API credentials to unauthorised third parties.
-
Perform automated scraping, data harvesting, or price extraction.
-
Act in a manner that may compromise the security, stability, or commercial interests of iWantFuel, its clients, or its network partners.
Websites, systems, or organisations that are identified as violating these policies may have their API credentials revoked and their originating IP addresses permanently blocked from accessing the iWantFuel platform and its API infrastructure.
All API integrations are monitored and may be audited by iWantFuel. Access to the API is granted solely at the discretion of iWantCorp (Pty) Ltd and may be suspended or terminated immediately if security, compliance, or commercial risks are identified.
Benefits to Your Business
All API endpoints are protected using API key and Secret Key authentication. Clients are issued unique credentials to ensure secure and isolated usage.
- Zero fraud exposure, eliminate card skimming, duplicate swipes, and unauthorized refuels.
- Zero paperwork, API-driven, with clean digital records
- Zero delays, Orders placed instantly, drivers notified in real time.
- Zero fees, no card fees, no subscription costs, no setup charges
- Complete control, you choose how, when, and where vehicles refuel
Conclusion
The iWantFuel API is more than a technical integration, it’s a leap forward in fleet fuel management. By connecting your systems directly to our platform, you gain precision, efficiency, and security, all while reducing operating costs and eliminating fraud.
Whether you're a tech team looking to integrate, or a fleet manager wanting more control, our API is ready to plug into your workflow.
Get the Code
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.
C# - HttpClient
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php");
request.Headers.Add("X-API-KEY", "Enter you API Key Here");
request.Headers.Add("X-SECRET-KEY", "Enter your Secret key Here");
var content = new StringContent("{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}", null, "application/json");
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/IWFV3-create-order-V1.php", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("X-API-KEY", "Enter you API Key Here");
request.AddHeader("X-SECRET-KEY", "Enter your Secret key Here");
var body = @"{" + "\n" +
@" ""Asset_Reg"": ""CFM00001"", " + "\n" +
@" ""Driver_Mobile"": ""0711234567"", " + "\n" +
@" ""Asset_Latitude"" : ""-34.90867357575131""," + "\n" +
@" ""Asset_Longitude"" : ""14.59708217135603""," + "\n" +
@" ""Fill_Type"" : ""Exact Quantity"", " + "\n" +
@" ""Best_Site_Price_Threshold_KM"" : ""10"", " + "\n" +
@" ""Cheapest_or_Closest"" : ""Closest"", " + "\n" +
@" ""internal_order_number"" : """", " + "\n" +
@" ""Total_Litres_or_Currency"" : ""10"" " + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
cURL
curl --location 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: Enter you API Key Here' \
--header 'X-SECRET-KEY: Enter your Secret key Here' \
--data '{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}'
Dart - dio
var headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
};
var data = json.encode({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
var dio = Dio();
var response = await dio.request(
'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
print(json.encode(response.data));
}
else {
print(response.statusMessage);
}
Dart - http
var headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
};
var request = http.Request('POST', Uri.parse('https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php'));
request.body = json.encode({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
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/IWFV3-create-order-V1.php"
method := "POST"
payload := strings.NewReader(`{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-API-KEY", "Enter you API Key Here")
req.Header.Add("X-SECRET-KEY", "Enter your Secret key Here")
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
POST /api/IWFV3-create-order-V1.php HTTP/1.1
Host: www.iwantfuel.tech
Content-Type: application/json
X-API-KEY: Enter you API Key Here
X-SECRET-KEY: Enter your Secret key Here
Content-Length: 336
{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}
Java - OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}");
Request request = new Request.Builder()
.url("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-KEY", "Enter you API Key Here")
.addHeader("X-SECRET-KEY", "Enter your Secret key Here")
.build();
Response response = client.newCall(request).execute();
Java - Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")
.header("Content-Type", "application/json")
.header("X-API-KEY", "Enter you API Key Here")
.header("X-SECRET-KEY", "Enter your Secret key Here")
.body("{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}")
.asString();
JavaScript - Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("X-API-KEY", "Enter you API Key Here");
myHeaders.append("X-SECRET-KEY", "Enter your Secret key Here");
const raw = JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.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/IWFV3-create-order-V1.php",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"X-API-KEY": "Enter you API Key Here",
"X-SECRET-KEY": "Enter your Secret key Here"
},
"data": JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
JavaScript - XHR
// WARNING: For POST requests, body is set to null by browsers.
var data = JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("X-API-KEY", "Enter you API Key Here");
xhr.setRequestHeader("X-SECRET-KEY", "Enter your Secret key Here");
xhr.send(data);
Kotlin - Okhttp
val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("X-API-KEY", "Enter you API Key Here")
.addHeader("X-SECRET-KEY", "Enter your Secret key Here")
.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, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.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, "Content-Type: application/json");
headers = curl_slist_append(headers, "X-API-KEY: Enter you API Key Here");
headers = curl_slist_append(headers, "X-SECRET-KEY: Enter your Secret key Here");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \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 = JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
},
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': 'POST',
'hostname': 'www.iwantfuel.tech',
'path': '/api/IWFV3-create-order-V1.php',
'headers': {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
},
'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 = JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
});
req.write(postData);
req.end();
NodeJs - Request
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php',
'headers': {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
},
body: JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
NodeJs - Unirest
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php',
'headers': {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
},
body: JSON.stringify({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.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/IWFV3-create-order-V1.php"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/json",
@"X-API-KEY": @"Enter you API Key Here",
@"X-SECRET-KEY": @"Enter your Secret key Here"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
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
open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}";;
let reqBody =
let uri = Uri.of_string "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php" in
let headers = Header.init ()
|> fun h -> Header.add h "Content-Type" "application/json"
|> fun h -> Header.add h "X-API-KEY" "Enter you API Key Here"
|> fun h -> Header.add h "X-SECRET-KEY" "Enter your Secret key Here"
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)
PHP - cURL
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.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 =>'{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'X-API-KEY: Enter you API Key Here',
'X-SECRET-KEY: Enter your Secret key Here'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
PHP - Guzzle
<?php
$client = new Client();
$headers = [
'Content-Type' => 'application/json',
'X-API-KEY' => 'Enter you API Key Here',
'X-SECRET-KEY' => 'Enter your Secret key Here'
];
$body = '{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
}';
$request = new Request('POST', 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.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/IWFV3-create-order-V1.php');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/json',
'X-API-KEY' => 'Enter you API Key Here',
'X-SECRET-KEY' => 'Enter your Secret key Here'
));
$request->setBody('{\n "Asset_Reg": "CFM00001", \n "Driver_Mobile": "0711234567", \n "Asset_Latitude" : "-34.90867357575131",\n "Asset_Longitude" : "14.59708217135603",\n "Fill_Type" : "Exact Quantity", \n "Best_Site_Price_Threshold_KM" : "10", \n "Cheapest_or_Closest" : "Closest", \n "internal_order_number" : "", \n "Total_Litres_or_Currency" : "10" \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/IWFV3-create-order-V1.php');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
'Content-Type' => 'application/json',
'X-API-KEY' => 'Enter you API Key Here',
'X-SECRET-KEY' => 'Enter your Secret key Here'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
PowerShell - RestMethod
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("X-API-KEY", "Enter you API Key Here")
$headers.Add("X-SECRET-KEY", "Enter your Secret key Here")
$body = @"
{
`"Asset_Reg`": `"CFM00001`",
`"Driver_Mobile`": `"0711234567`",
`"Asset_Latitude`" : `"-34.90867357575131`",
`"Asset_Longitude`" : `"14.59708217135603`",
`"Fill_Type`" : `"Exact Quantity`",
`"Best_Site_Price_Threshold_KM`" : `"10`",
`"Cheapest_or_Closest`" : `"Closest`",
`"internal_order_number`" : `"`",
`"Total_Litres_or_Currency`" : `"10`"
}
"@
$response = Invoke-RestMethod 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
Python - http.client
import http.client
import json
conn = http.client.HTTPSConnection("www.iwantfuel.tech")
payload = json.dumps({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
})
headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
}
conn.request("POST", "/api/IWFV3-create-order-V1.php", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Python - Requests
import requests
import json
url = "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php"
payload = json.dumps({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
})
headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'Enter you API Key Here',
'X-SECRET-KEY': 'Enter your Secret key Here'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
R - httr
library(httr)
headers = c(
'Content-Type' = 'application/json',
'X-API-KEY' = 'Enter you API Key Here',
'X-SECRET-KEY' = 'Enter your Secret key Here'
)
body = '{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
}';
res <- VERB("POST", url = "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php", body = body, add_headers(headers))
cat(content(res, 'text'))
R - RCurl
library(RCurl)
headers = c(
"Content-Type" = "application/json",
"X-API-KEY" = "Enter you API Key Here",
"X-SECRET-KEY" = "Enter your Secret key Here"
)
params = "{
\"Asset_Reg\": \"CFM00001\",
\"Driver_Mobile\": \"0711234567\",
\"Asset_Latitude\": \"-34.90867357575131\",
\"Asset_Longitude\": \"14.59708217135603\",
\"Fill_Type\": \"Exact Quantity\",
\"Best_Site_Price_Threshold_KM\": \"10\",
\"Cheapest_or_Closest\": \"Closest\",
\"internal_order_number\": \"\",
\"Total_Litres_or_Currency\": \"10\"
}"
res <- postForm("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php", .opts=list(postfields = params, httpheader = headers, followlocation = TRUE), style = "httppost")
cat(res)
Ruby - Net::HTTP
require "uri"
require "json"
require "net/http"
url = URI("https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["X-API-KEY"] = "Enter you API Key Here"
request["X-SECRET-KEY"] = "Enter your Secret key Here"
request.body = JSON.dump({
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
})
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("Content-Type", "application/json".parse()?);
headers.insert("X-API-KEY", "Enter you API Key Here".parse()?);
headers.insert("X-SECRET-KEY", "Enter your Secret key Here".parse()?);
let data = r#"{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude": "-34.90867357575131",
"Asset_Longitude": "14.59708217135603",
"Fill_Type": "Exact Quantity",
"Best_Site_Price_Threshold_KM": "10",
"Cheapest_or_Closest": "Closest",
"internal_order_number": "",
"Total_Litres_or_Currency": "10"
}"#;
let json: serde_json::Value = serde_json::from_str(&data)?;
let request = client.request(reqwest::Method::POST, "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")
.headers(headers)
.json(&json);
let response = request.send().await?;
let body = response.text().await?;
println!("{}", body);
Ok(())
}
Ruby - Httpie
printf '{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}'| http --follow --timeout 3600 POST 'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php' \
Content-Type:'application/json' \
X-API-KEY:'Enter you API Key Here' \
X-SECRET-KEY:'Enter your Secret key Here'
Shell - wget
wget --no-check-certificate --quiet \
--method POST \
--timeout=0 \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: Enter you API Key Here' \
--header 'X-SECRET-KEY: Enter your Secret key Here' \
--body-data '{
"Asset_Reg": "CFM00001",
"Driver_Mobile": "0711234567",
"Asset_Latitude" : "-34.90867357575131",
"Asset_Longitude" : "14.59708217135603",
"Fill_Type" : "Exact Quantity",
"Best_Site_Price_Threshold_KM" : "10",
"Cheapest_or_Closest" : "Closest",
"internal_order_number" : "",
"Total_Litres_or_Currency" : "10"
}' \
'https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php'
Swift - URLSession
let parameters = "{\n \"Asset_Reg\": \"CFM00001\", \n \"Driver_Mobile\": \"0711234567\", \n \"Asset_Latitude\" : \"-34.90867357575131\",\n \"Asset_Longitude\" : \"14.59708217135603\",\n \"Fill_Type\" : \"Exact Quantity\", \n \"Best_Site_Price_Threshold_KM\" : \"10\", \n \"Cheapest_or_Closest\" : \"Closest\", \n \"internal_order_number\" : \"\", \n \"Total_Litres_or_Currency\" : \"10\" \n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://www.iwantfuel.tech/api/IWFV3-create-order-V1.php")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Enter you API Key Here", forHTTPHeaderField: "X-API-KEY")
request.addValue("Enter your Secret key Here", forHTTPHeaderField: "X-SECRET-KEY")
request.httpMethod = "POST"
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()
