Add a single plate to the list in my AXIS P1465-LE-3 #721
-
I want to add a single plate to the list in my AXIS P1465-LE-3 License Plate Verifier Kit Version : 2.8-4. but my code java eclipse displays error. //My java prog from curl --trace-ascii trace.txt --anyauth -u "root:pass" -X GET "http://10.0.3.176:8080/local/fflprapp/api.cgi? import java.io.IOException; public class Main { // Définissez l'URL de la requête // Envoyez la requête asynchrone // Vérifiez si la réponse est réussie (statut 200) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
This automatically generated reply acts as a friendly reminder. Answers to your questions will most often come from the community, from developers like yourself. You will, from time to time, find that Axis employees answers some of the questions, but this is not a guarantee. Think of the discussion forum as a complement to other support channels, not a replacement to any of them. If your question remains unanswered for a period of time, please revisit it to see whether it can be improved by following the guidelines listed in Axis support guidelines. |
Beta Was this translation helpful? Give feedback.
-
Hi @basiclog , |
Beta Was this translation helpful? Give feedback.
-
Hi vivekatoffice const requestOptions = { |
Beta Was this translation helpful? Give feedback.
-
Hi @basiclog , Hi @axisvivek! I don't think Originally posted by @mattias-kindborg-at-work in #73 (comment)Here's a sample code I received from ChatGPT 😉. Please use it at your discretion. index.jsconst crypto = require('crypto'); // Import Node.js crypto module
const fetch = require('node-fetch'); // Import node-fetch for making HTTP requests
async function fetchDigest(url, options, username, password) {
let response = await fetch(url, options);
if (response.status === 401 && response.headers.get('www-authenticate')) {
const authHeader = response.headers.get('www-authenticate');
const digestAuthDetails = parseDigestAuth(authHeader, username, password, options.method, url);
response = await fetch(url, {
...options,
headers: {
...options.headers,
Authorization: digestAuthDetails
}
});
}
return response;
}
function parseDigestAuth(authHeader, username, password, method, uri) {
const authDetails = {};
const nc = '00000001'; // Nonce count
const cnonce = crypto.randomBytes(8).toString('hex'); // Client nonce
authHeader.replace(/([a-z0-9_-]+)="?([^",]+)"?/gi, (match, key, value) => {
authDetails[key] = value;
});
const ha1 = md5(`${username}:${authDetails.realm}:${password}`);
const ha2 = md5(`${method}:${uri}`);
const response = md5(`${ha1}:${authDetails.nonce}:${nc}:${cnonce}:${authDetails.qop}:${ha2}`);
return `Digest username="${username}", realm="${authDetails.realm}", nonce="${authDetails.nonce}", uri="${uri}", qop=${authDetails.qop}, nc=${nc}, cnonce="${cnonce}", response="${response}"`;
}
function md5(input) {
return crypto.createHash('md5').update(input).digest('hex');
}
async function callVAPIX() {
// Replace with your actual VAPIX API credentials and endpoint
const username = 'vivek';
const password = 'kumar';
const url = 'http://10.176.12.148/axis-cgi/customhttpheader.cgi';
const requestBody = {
apiVersion: '1.0',
method: 'list'
};
const response = await fetchDigest(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
}, username, password);
if (response.ok) {
const data = await response.json();
console.log('API response:', data);
} else {
console.error('API call failed with status:', response.status);
}
}
async function callVAPIX2() {
// Replace with your actual VAPIX API credentials and endpoint
const username = 'root';
const password = 'pass';
const url = 'http://10.176.12.148/axis-cgi/ssh.cgi';
const requestBody = {
apiVersion: '1.0',
method: 'getSshInfo'
};
const response = await fetchDigest(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
}, username, password);
if (response.ok) {
const data = await response.json();
console.log('API response:', data);
} else {
console.error('API call failed with status:', response.status);
}
}
callVAPIX();
callVAPIX2(); mkdir vapix-test1
cd vapix-test1
npm init -y
npm install node-fetch@2 crypto
Output: |
Beta Was this translation helpful? Give feedback.
-
hi vivekatoffice |
Beta Was this translation helpful? Give feedback.
Hi @basiclog ,
I don't know where it is failing for your device. Let me know the Axis OS version and device model so I can try it locally.
I used the following Axis device:
AXIS Q1715 Block Camera ( AXIS OS version 11.11.73)