We're enhancing the security of our API interactions. Previously, API authentication required a base64 token generated from your username and password. This method is not the most secure because your main account credentials are directly used for API access.
To improve security, we’ve introduced API Keys. This new method utilises unique keys that are not tied to your account login details, thereby minimising risks in case of a security breach.
The shift from basic authentication to API keys is a best practice in API security. It provides:
Generate Your API Key:
Go to the 'API Keys' section under 'Edit User Details'.
Click on 'Add New API Key'.
Choose a name for your key and set the expiration period.
Click 'Create API Key'.
Copy Your Client ID and API Key:
Use Your New API Keys: Replace your previous basic authentication method with the new headers using your Client ID and API
curl --location '<https://simpro4.wirelesslogic.com/api/v3/billing-accounts>' \\
--header 'x-api-client: {client-id}' \\
--header 'x-api-key: {api-key}'
Transitioning to the new API Key authentication system requires changes in the way you make API requests in your applications. To help you integrate this change seamlessly, we’ve provided examples in several popular programming languages.
Python
import requests
url = '<https://simpro4.wirelesslogic.com/api/v3/billing-accounts>'
headers = {
'x-api-client': 'your-client-id',
'x-api-key': 'your-api-key',
}
response = requests.get(url, headers=headers)
print(response.text)
JavaScript (NodeJS)
const fetch = require('node-fetch');
const url = '<https://simpro4.wirelesslogic.com/api/v3/billing-accounts>';
const headers = {
'x-api-client': 'your-client-id',
'x-api-key': 'your-api-key'
};
fetch(url, { method: 'GET', headers: headers })
.then(response => response.text())
.then(text => console.log(text))
.catch(err => console.error('error:', err));
Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException, InterruptedException {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("<https://simpro4.wirelesslogic.com/api/v3/billing-accounts>"))
.header("x-api-client", "your-client-id")
.header("x-api-key", "your-api-key")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}