phpipam / phpipam

phpipam development repository
https://phpipam.net
2.23k stars 733 forks source link

Empty POST to Devices API Controller produces a blank device #4307

Open riversdev0 opened 7 hours ago

riversdev0 commented 7 hours ago

Describe the bug Submitting an empty POST to the Devices Controller creates a blank Device. Yet, in the GUI, the hostname field is mandatory.

phpIPAM version Versions of phpIPAM known to contain the issue.

Your Environment (please supply the following information): n/a

Steps To Reproduce

  1. Create a Device using the API with no payload.
  2. In the GUI see that you have a new blank device.

Screenshots and error logs none

Additional Info none

riversdev0 commented 7 hours ago

In addition to the above, the following payload:

{"hostname": "switch M3TS 1"}

produces the following error:

{"code":400,"success":false,"message":"No parameters","time":0.003}
riversdev0 commented 7 hours ago

Adding description to the payload made it work. The following was successful:

{"hostname": "switch PAH9 1","description": "patu"}