I am having a problem with Missing required attribute for CUPS-Get-Devices. Basically I want to get list of available printers with IPP and CUPS using https://www.npmjs.org/package/ipp.
I've implemented CUPS-Get-Devices into the package as it had not support the attribute for the package but I get it working. Problem is that the response respond with "status-message": "Missing required attributes." and not giving me the list of printers.
var uri = "http://localhost:631"
var data = ipp.serialize({
"operation": "CUPS-Get-Printers",
"operation-attributes-tag": {
"attributes-charset": 'utf-8',
"attributes-natural-language": 'en-us',
"limit": 10
}
});
ipp.request(uri, data, function(err, res){
if(err){
return console.log(err);
}
console.log(JSON.stringify(res,null,2));
});
The response is
{
"version": "2.0",
"statusCode": "client-error-bad-request",
"id": 67392993,
"operation-attributes-tag": {
"attributes-charset": "utf-8",
"attributes-natural-language": "en-us",
"status-message": "Missing required attributes."
}
}
The documentation doesn't say anything about other required parameters http://www.cups.org/documentation.php/spec-ipp.html#CUPS_GET_PRINTERS
Does anybody know where's the problem? Thank you!
This code works for me, with an unmodified ipp library and with CUPS 1.7.3. My best guess is that you've made a typo or something when you modified the library.
var ipp = require('ipp');
// Add missing operation code
ipp.operations['CUPS-Get-Printers'] = 0x4002;
// The rest is identical to your code:
var uri = "http://localhost:631";
var data = ipp.serialize({
"operation": "CUPS-Get-Printers",
"operation-attributes-tag": {
"attributes-charset": 'utf-8',
"attributes-natural-language": 'en-us',
"limit": 10
}
});
ipp.request(uri, data, function(err, res){
if(err){
return console.log(err);
}
console.log(JSON.stringify(res,null,2));
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With