Error: Unknown method in my web application

Hey,

i developing a web application in which i using the pipedrive api.

Now i want to update data of a person. I already tryed it in postman and all works well. But if i do the same in my web application i’ve got the response {“status”:false,“error”:“Unknown method .”}.

I can’t find any mistakes.

This is my code:

public function updatePerson( $id, $data ){
       
        $url = $this->end_point . "/persons/$id?api_token=" . $this->token;
        $key = key($data);
        $body = [
            $key => $data[$key] 
        ];

        $args = [
            'body'        => $body,
            'timeout'     => '5',
            'redirection' => '5',
            'httpversion' => '1.0',
            'blocking'    => true,
            'headers'     => array(),
            'cookies'     => array()
        ];

        $result = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
        var_dump($result);
    }

Do anyone have an idea to solve it?

Hi @StefanB
Welcome to the community :wave: and thanks for being patient.

Also the snippet that you added here was very useful. I only suspect one thing. The API call to update a person is a PUT request

https://developers.pipedrive.com/docs/api/v1/Persons#updatePerson

Are you making a PUT call or POST? Let me know