phpipam / phpipam

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

create subnet within folder via api #706

Closed passie closed 8 years ago

passie commented 8 years ago

How do I create a subnet within a folder? I'm getting the following message while the folder doens't have a subnet declared ?

{ "code": 400, "success": false, "message": "Subnet is not within boundaries of its master subnet"}

phpipam commented 8 years ago

This should do it (masterSubnetId=9 (folder)):

*   Trying 46.19.10.34...
* Connected to devel.phpipam.net (46.19.10.34) port 80 (#0)
> POST /1.3/api/apiclient/folders/9/?subnet=10.10.10.0&mask=24&sectionId=4&masterSubnetId=9&description=API HTTP/1.1
Host: devel.phpipam.net
User-Agent: phpipam-api php class
Accept: */*
Content-Type: application/json
token: removed

< HTTP/1.1 201 Created
< Date: Mon, 12 Sep 2016 18:56:12 GMT
< Cache-Control: no-cache
< Pragma: no-cache
< Location: /api/apiclient/subnets/795/
< Content-Length: 54
< Content-Type: application/json
< 
* Connection #0 to host devel.phpipam.net left intact
Array
(
    [code] => 201
    [success] => 1
    [message] => Subnet created
)
passie commented 8 years ago

thank you

passie commented 8 years ago

using the following url: https://someurl.com/api/soapUI/folders/3/subnet=10.10.10.0&mask=24&sectionId=3&masterSubnetId=101&description=API

still getting the "message": "Subnet is not within boundaries of its master subnet"

while the same subnet created manually:

"code": 200,
"success": true,
"data": {
    "id": "132",
    "subnet": "10.10.10.0",
    "mask": "24",
    "sectionId": "3",
    "description": "API",
    "firewallAddressObject": null,
    "vrfId": "0",
    "masterSubnetId": "101",
    "allowRequests": "0",
    "vlanId": "0",
    "showName": "0",
    "device": "0",
    "permissions": "{\"2\":\"3\",\"3\":\"3\"}",
    "pingSubnet": "0",
    "discoverSubnet": "0",
    "DNSrecursive": "0",
    "nameserverId": "0",
    "DNSrecords": "0",
    "scanAgent": "0",
    "isFolder": "0",
    "isFull": "0",
    "tag": "2",
    "editDate": null,

}

Any advise ?

tomcanham commented 8 years ago

Dupe of https://github.com/phpipam/phpipam/issues/577? Note that the fix is not in a release branch yet, if it's the same thing. You'll have to check out master to get it.

passie commented 8 years ago

duplicated of #577. closing this one.