Skip to main content

Module client

Module client 

Source
Expand description

The production PhpIpamApi: phpIPAM’s REST API over HTTP/1.1.

Two queries, of which one always runs:

QuerySource
<app_id>/addresses/search/<ip>/always
<app_id>/devices/<id>/device

§Two things phpIPAM does that NetBox does not

Authentication is a bare token header, not Authorization. phpIPAM calls it the application’s app code, configured per API application under Administration → API with security “SSL with App code”. The other scheme — user credentials exchanged for a six-hour session token — is deliberately not implemented: it needs a refresh loop and a place to keep the token, for no gain over a credential that can simply be rotated in the environment.

An unknown address is a 404, not an empty list, and the body is a phpIPAM envelope rather than an HTTP error page. That is why search returns Ok(None) for it — a fact about the address, not a failure to look it up — and why the shared transport carries the status at all.

§The envelope

Every phpIPAM answer is {"code": 200, "success": true, "data": …}, with data an array for a search and an object for a detail read. Custom columns are plain top-level members of each row (custom_acme_allowed_names), unlike NetBox’s nested custom_fields.

Structs§

PhpIpamClient
A phpIPAM REST client.