Skip to content
Enrico edited this page Feb 13, 2024 · 2 revisions

Get a Item

Do a GET request to /v2/items/CODE, where CODE is the Item code.
You must use the session cookie to authenticate this request.
If the Item exists in the database, the response will look like this:

{
    "code": "95",
    "features": {
      "brand": "HP",
      "model": "Compaq nc6000 (PD468AA#ABZ)",
      "motherboard-form-factor": "proprietary-laptop",
      "notes": "Supporta PXE (attivare in BIOS > security, F12 per usarlo), A61 adatto. No PAE, usare \"forcepae\" e parte. Scheda wifi rilevata ma è disattivata e non trova reti, capire perché. La batteria dura 38 min. Lettore di schede SD.",
      "os-license-code": "TH1S-1SN0T-AV4L-1DPR-0DUC-TK3Y",
      "os-license-version": "Windows XP Professional",
      "power-connector": "barrel",
      "psu-ampere": 3.5,
      "psu-volt": 18.5,
      "sn": "CNU666D24G",
      "software": "Xubuntu 18.04 LTS",
      "type": "case",
      "working": "yes"
    },
    "contents": [
      {
        "code": "B117",
        "features": {
          "brand": "HP",
          "ethernet-ports-1000m-n": 1,
          "ide-ports-n": 1,
          "integrated-graphics-brand": "ATI",
          "integrated-graphics-model": "Mobility Radeon 9600/9700",
          "key-bios-setup": "F10",
          "mac": "c0:ff:ee:b3:33:3f",
          "mini-jack-ports-n": 2,
          "mini-pci-sockets-n": 1,
          "model": "0890h",
          "motherboard-form-factor": "proprietary-laptop",
          "owner": "DISAT",
          "parallel-ports-n": 1,
          "ram-form-factor": "sodimm",
          "ram-type": "ddr",
          "rj11-ports-n": 1,
          "s-video-ports-n": 1,
          "serial-ports-n": 1,
          "type": "motherboard",
          "vga-ports-n": 1,
          "working": "yes"
        },
        "contents": [
          {
            "code": "C122",
            "features": {
              "brand": "Intel",
              "core-n": 1,
              "frequency-hertz": 1700000000,
              "model": "Pentium M 1.70 GHz",
              "owner": "DISAT",
              "type": "cpu",
              "variant": "17",
              "working": "yes"
            }
          },
          {
            "code": "R101",
            "features": {
              "brand": "Nanya",
              "capacity-byte": 536870912,
              "frequency-hertz": 167000000,
              "model": "NT512D64SH8A0FM-6K",
              "owner": "DISAT",
              "ram-form-factor": "sodimm",
              "ram-type": "ddr",
              "type": "ram",
              "working": "yes"
            }
          },
          {
            "code": "W5",
            "features": {
              "brand": "HP",
              "brand-manufacturer": "Intel",
              "mac": "00:0e:35:7d:33:b0",
              "mini-pci-sockets-n": 1,
              "model": "PRO/Wireless 2200BG",
              "sn": "CNX7373ASD",
              "type": "wifi-card"
            }
          }
        ]
      },
      {
        "code": "HDD197",
        "features": {
          "brand": "Hitachi",
          "capacity-decibyte": 40000000000,
          "hdd-odd-form-factor": "2.5-9.5mm",
          "mini-ide-ports-n": 1,
          "model": "MK4026GAX",
          "owner": "DISAT",
          "smart-data": "ok",
          "sn": "X1HF4444T",
          "spin-rate-rpm": 5400,
          "type": "hdd",
          "working": "yes"
        }
      },
      {
        "code": "ODD138",
        "features": {
          "brand": "HL-DT-ST",
          "color": "black",
          "hdd-odd-form-factor": "laptop-odd-9.5mm",
          "jae-ports-n": 1,
          "model": "RW/DVD GCC-4243N",
          "notes": "Scrive i CD ma i DVD li legge solo solo... 💿",
          "odd-type": "dvd-r",
          "owner": "DISAT",
          "type": "odd"
        }
      }
    ],
    "location": [
      "Polito",
      "LabFis4",
      "ArmadioL"
    ]
}

However, note that products and items are merged. This is easier when you just want to read, but if you plan to modify an item in some way it's not ideal.

Alternatively, you can make a request to /v2/items/CODE?separate.

Compare, without ?separate (item and product merged):

{
  "code": "R777",
  "features": {
    "capacity-byte": 536870912,
    "color": "green",
    "frequency-hertz": 667000000,
    "ram-ecc": "no",
    "ram-form-factor": "dimm",
    "ram-type": "ddr2",
    "type": "ram",
    "brand": "Samsung",
    "model": "S667ABC512",
    "sn": "ASD10A7C123456",
    "variant": "v1",
    "working": "no"
  },
  "location": [
    "Polito",
    "Chernobyl",
    "Table",
    "RamBox"
  ]
}

and with ?separate:

{
  "code": "R777",
  "features": {
    "brand": "Samsung",
    "model": "S667ABC512",
    "sn": "ASD10A7C123456",
    "variant": "v1",
    "working": "no"
  },
  "product": {
    "brand": "Samsung",
    "model": "S667ABC512",
    "variant": "v1",
    "features": {
      "capacity-byte": 536870912,
      "color": "green",
      "frequency-hertz": 667000000,
      "ram-ecc": "no",
      "ram-form-factor": "dimm",
      "ram-type": "ddr2",
      "type": "ram"
    }
  },
  "location": [
    "Polito",
    "Chernobyl",
    "Table",
    "RamBox"
  ]
}

Response codes:
200 - Item found
404 - Item not found
401 - The user is not authenticated or session has expired

From a single feature (if it's reasonably unique)

There's a GET /v1/features/{feature}/{value} endpoint that returns a list of items with a given feature value that must match exactly. Only text features are supported, i.e. the ones that you type into a text box (no dropdown, no numeric values with units, etc...).

It returns only the codes of the first few items, so it is useful only for features that should be unique, like serial numbers. The code that feeds the endpoint is used internally to find duplicate serial numbers, for example.

Examples:

GET /v2/features/sn/CN0M618F179729260FVOA00
{
  "status": "success",
  "data": [
    "A5"
  ]
}
GET /v2/features/sn/serial-number-that-doesnt-exist
{
  "status": "success",
  "data": []
}

Response codes:
200 - Request succeeded (may contain results or an empty array)
401 - The user is not authenticated or session has expired

From features

If you need anything more complex or expect a lot of results, use the search endpoints.