Skip to content

Invalid request for subnet creation using Php Api clients #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mavrickultra opened this issue Aug 27, 2021 · 1 comment
Open

Invalid request for subnet creation using Php Api clients #33

mavrickultra opened this issue Aug 27, 2021 · 1 comment

Comments

@mavrickultra
Copy link

Hi,
I have a problem when i try to create a subnet after calling /api/my_app/sections/{id}/subnets/.
When i create the subnet alone without doing a get request to /api/my_app/sections/{id}/subnets/, it creates the subnet normally.
the code that is causing me a problem is this :
$this->execute('GET','sections',array("id"=>1,array('id2'=>'subnets',
//Ajout des filtres.
'filter_by'=>'description',
'filter_value'=>'subnet Infor'
),
$this->Token);
$this->execute('POST','subnets',array(),array("subnet"=>"172.13.0.32","sectionId"=>1,"mask"=>29,"masterSubnetId"=>$subnetId),
$this->Token);
my problem is when i delete the the call to return all subnets in section, it work prefectrly otherwise it gives this error :

array:4 [▼
  "code" => 400
  "success" => false
  "message" => """
    Invalid request key id2***stdClass Object


    (


        [app_id] => Wifup


        [controller] => sections


        [id] => 1


        [id2] => subnets


        [filter_by] => description


        [filter_value] => subnet Infor


        [subnet] => 172.13.0.32


        [sectionId] => 1


        [mask] => 29


        [masterSubnetId] => 31


    )


    """
  "time" => 0.023
]
I want to know why i get this error if i use the two calls and what im missing, because as i see phpipam remember the parameter sent in the first call so that is why i get the error.
@Inopsek
Copy link

Inopsek commented Aug 9, 2022

Hi,

In private function curl_set_connection() :
As Connection exist and curl_init() had been done on your first call there is no more reset of $url

I removed the test condition on $this->Connection line 655 to ensure that $url will be replaced on each call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants