Forum Discussion

ianf's avatar
2 years ago

Add Device via API

Hi - I'm trying to add a device via API and Powershell. 

I've prepared the following JSON which im passing as a BODY object via POST.

    "description":  "Test Server",
    "name":  "xx",
    "displayName":  "xx",
    "preferredCollectorID":  xx

Is this enough data to POST - im getting a 1404 back which suggest an object doesn't exist (i assume in the case the Collector?). But that def the ID as ive retrieved it from a separate GET.

Im making other REST calls using the same function so pretty sure my code is ok.

The guide ive used for reference is below (even though its v1 I think this is correct) as the properties below are the only required ones.






name The host name or IP address of the device Yes String “name”:”″
displayName The display name of the device Yes String “displayName”:”ProdServer24″
preferredCollectorId The Id of the preferred collector assigned to monitor the device Yes Integer “preferredCollectorId”:85


Add a Device | LogicMonitor

Any help would be appreciated.


3 Replies

  • Oh dear - massive schoolboy error.

    I had ID instead of Id :)/emoticons/smile@2x.png 2x" title=":)" width="20" />

     "preferredCollectorID":  108

    Thanks for your help anyway!

    Working now :)/emoticons/smile@2x.png 2x" title=":)" width="20" />

  • What's the endpoint you're hitting? 1404 means the resource (api resource, aka endpoint, aka url) isn't found. You should be posting to /device/devices. Does your response contain anything other than the 1404 error?

  • Hi - I'm hitting /device/devices with the above JSON body using a POST

    Oddly enough I'm getting

    Function statuscode is 1404
    Function return data is
    Function return items are
    Function return body is @{data=; errmsg=Collector(id=0) does not exist; status=1404}

    Body data is

        "description":  "Test Server",
        "name":  "bwu-qts-ojtst54",
        "displayName":  "bwu-qts-ojtst54",
        "preferredCollectorID":  108

    Almost like it expects a collectorID? Should i be posting with any other data?

    The reference is only API 1.0 so i dont know if API 3.0 has any other mandatory fields either.