PHP code example of apigee / edge

1. Go to this page and download the library: Download apigee/edge library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apigee / edge example snippets



// Your organization name
$org = 'my-org';
// API endpoint in Apigee’s cloud
$endpoint = 'https://api.enterprise.apigee.com/v1';
// Authenticated user for this organization.
// This user should have the ‘devadmin’ (or ‘orgadmin’) role on Edge.
$user = '[email protected]';
// Password for the above user
$pass = 'i<3apis';
// An array of other connection options
$options = array(
  'http_options' => array(
    'connection_timeout' => 4,
    'timeout' => 4
  )
);

$org_config = new Apigee\Util\OrgConfig($org, $endpoint, $user, $pass, $options);


$developer = new Apigee\ManagementAPI\Developer($org_config);
try {
  $developer->load('[email protected]');
  $developer->setFirstName('John');
  $developer->setLastName('Doe');
  $developer->save();
  print "Developer updated!\n";
}
catch (Apigee\Exceptions\ResponseException $e) {
  print $e->getMessage();
}

$app = new Apigee\ManagementAPI\DeveloperApp($org_config, $developer->getEmail());
try {
  $app_list = $app->getListDetail();
  foreach ($app_list as $my_app) {
    print $my_app->getName() . "\n";
  }
}
catch (Apigee\Exceptions\ResponseException $e) {
  print $e->getMessage();
}