I am trying to delete a developer, who is logged in into his account. I am doing this through Wordpress website. The registerred wordpress user corresponds to an Apigee developer. In this case I am trying only to remove a developer. If I try with just adding an e-mail at the end of the url it works but when I try to get the email of the currently logged user it gives me the following message.
[body] => [response] => Array ( [code] => 405 [message] => Method Not Allowed ) [cookies] => Array ( ) [filename] => [http_response] => WP_HTTP_Requests_Response Object ( [response:protected] => Requests_Response Object ( [body] => [raw] => HTTP/1.1 405 Method Not Allowed
//Delete from apigee $urlbegin='https://api.enterprise.apigee.com/v1/organizations/xxx-trial/developers/'; $varemail= $current_user->user_email ; $url= $urlbegin.$varemail; $args = array( 'method' => 'DELETE','headers'=> array( 'Authorization' => 'Basic xxxxxxxx')); $response = wp_remote_request( esc_url_raw($url), $args ); if ( is_wp_error( $response ) ) { $error_message = $response->get_error_message(); echo "Something went wrong: $error_message"; } else { echo 'Response:<pre>'; print_r( $response ); echo '</pre>'; }
Solved! Go to Solution.
Hello:)
I was trying to delete a developer that consumes my API's. Actually I succeeded in doing that. I created a plugin that deletes a wordpress account and then combined that with another plugin that deletes a developer here. So now it's fine!! Thank you for the reply.
HI @Vanina Yordanova - not sure I understood the problem completely. Are you trying to delete a developer who is consuming your API hosted in Apigee or a developer whose is logging into Apigee to expose or develop APIs ? The end point URL you mentioned is for the former
Can you elaborate on what exactly you want to do please ?
Hello:)
I was trying to delete a developer that consumes my API's. Actually I succeeded in doing that. I created a plugin that deletes a wordpress account and then combined that with another plugin that deletes a developer here. So now it's fine!! Thank you for the reply.