Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3   10.4   10.5    Statistic    FMM    Blog  

CUPS.GetPrintersAsJSON

Queries list of printers as JSON.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CUPS 10.5 Yes No Yes, macOS only No No
MBS( "CUPS.GetPrintersAsJSON" )   More

Parameters

none

Result

Returns JSON array or error.

Description

Queries list of printers as JSON.
Includes array with options list.
JSON objects include name, instance, isDefault, optionCount and options as sub array with name and value.

Examples

Query printers:

MBS( "CUPS.GetPrintersAsJSON" )

Example result:
[
  {
    "name":   "Brother_DCP_8085DN",
    "instance":   null,
    "isDefault":   false,
    "optionCount":   25,
    "options":   [
      {
        "name":   "copies",
        "value":   "1"
      },
      {
        "name":   "device-uri",
        "value":   "dnssd://Brother%20DCP-8085DN._pdl-datastream._tcp.local./?bidi"
      },
      {
        "name":   "finishings",
        "value":   "3"
      },
      {
        "name":   "job-cancel-after",
        "value":   "10800"
      },
      {
        "name":   "job-hold-until",
        "value":   "no-hold"
      },
      {
        "name":   "job-priority",
        "value":   "50"
      },
      {
        "name":   "job-sheets",
        "value":   "none,none"
      },
      {
        "name":   "marker-change-time",
        "value":   "1514723504"
      },
      {
        "name":   "marker-colors",
        "value":   "#000000,none"
      },
      {
        "name":   "marker-levels",
        "value":   "-3,0"
      },
      {
        "name":   "marker-names",
        "value":   "Black,Drum"
      },
      {
        "name":   "marker-types",
        "value":   "toner,drum"
      },
      {
        "name":   "number-up",
        "value":   "1"
      },
      {
        "name":   "printer-commands",
        "value":   "ReportLevels,PrintSelfTestPage,PJLBidirectional,PJLWrite,PJLRead"
      },
      {
        "name":   "printer-info",
        "value":   "Brother DCP-8085DN"
      },
      {
        "name":   "printer-is-accepting-jobs",
        "value":   "true"
      },
      {
        "name":   "printer-is-shared",
        "value":   "false"
      },
      {
        "name":   "printer-is-temporary",
        "value":   "false"
      },
      {
        "name":   "printer-location",
        "value":   ""
      },
      {
        "name":   "printer-make-and-model",
        "value":   "Brother DCP-8085DN CUPS"
      },
      {
        "name":   "printer-state",
        "value":   "5"
      },
      {
        "name":   "printer-state-change-time",
        "value":   "1586357640"
      },
      {
        "name":   "printer-state-reasons",
        "value":   "paused,com.brother.tray1-jam-warning,com.brother.duplex-jam-warning,com.brother.inside-hot-report,com.brother.drum-empty-report,cover-open-warning,media-jam-warning"
      },
      {
        "name":   "printer-type",
        "value":   "77639764"
      },
      {
        "name":   "printer-uri-supported",
        "value":   "ipp://localhost/printers/Brother_DCP_8085DN"
      }
    ]
  },
  {
    "name":   "EPSON_ET_7700_Series",
    "instance":   null,
    "isDefault":   true,
    "optionCount":   27,
    "options":   [
      {
        "name":   "copies",
        "value":   "1"
      },
      {
        "name":   "device-uri",
        "value":   "dnssd://EPSON%20ET-7700%20Series._ipps._tcp.local./?uuid=cfe91100-67c4-11e4-a45f-fee0271152ce"
      },
      {
        "name":   "finishings",
        "value":   "3"
      },
      {
        "name":   "job-cancel-after",
        "value":   "10800"
      },
      {
        "name":   "job-hold-until",
        "value":   "no-hold"
      },
      {
        "name":   "job-priority",
        "value":   "50"
      },
      {
        "name":   "job-sheets",
        "value":   "none,none"
      },
      {
        "name":   "marker-change-time",
        "value":   "1601626536"
      },
      {
        "name":   "marker-colors",
        "value":   "#000000,#00FFFF,#FF00FF,#FFFF00,#000000"
      },
      {
        "name":   "marker-high-levels",
        "value":   "100,100,100,100,100"
      },
      {
        "name":   "marker-levels",
        "value":   "97,97,97,97,97"
      },
      {
        "name":   "marker-low-levels",
        "value":   "15,15,15,15,15"
      },
      {
        "name":   "marker-names",
        "value":   "Photo\\ Black\\ ink,Cyan\\ ink,Magenta\\ ink,Yellow\\ ink,Black\\ ink"
      },
      {
        "name":   "marker-types",
        "value":   "ink,ink,ink,ink,ink"
      },
      {
        "name":   "number-up",
        "value":   "1"
      },
      {
        "name":   "printer-commands",
        "value":   "none"
      },
      {
        "name":   "printer-info",
        "value":   "EPSON ET-7700 Series"
      },
      {
        "name":   "printer-is-accepting-jobs",
        "value":   "true"
      },
      {
        "name":   "printer-is-shared",
        "value":   "false"
      },
      {
        "name":   "printer-is-temporary",
        "value":   "false"
      },
      {
        "name":   "printer-location",
        "value":   ""
      },
      {
        "name":   "printer-make-and-model",
        "value":   "EPSON ET-7700 Series-AirPrint"
      },
      {
        "name":   "printer-state",
        "value":   "3"
      },
      {
        "name":   "printer-state-change-time",
        "value":   "1601891140"
      },
      {
        "name":   "printer-state-reasons",
        "value":   "none"
      },
      {
        "name":   "printer-type",
        "value":   "69242972"
      },
      {
        "name":   "printer-uri-supported",
        "value":   "ipp://localhost/printers/EPSON_ET_7700_Series"
      }
    ]
  }
]

See also

Release notes

  • Version 10.5
    • Added CUPS.GetPrintersAsJSON and CUPS.GetJobsAsJSON functions.

Created 4th October 2020, last changed 5th October 2020


CUPS.GetPrinterName   -   CUPS.LastErrorCode

Feedback: Report problem or ask question.




Links
MBS FileMaker blog