@manojramakrishnan ,
You need little bit of Drupal Expertise to do same. You need to understand how to implement hooks that are exposed by apigee.
For Example, when you go to file /profiles/apigee/modules/custom/devconnect/devconnect_developer_apps/devconnect_developer_apps.api.php files, you can see list of hooks exposed by the module.
For example, one of the hook is hook_devconnect_developer_app_save($results, &$form_state) which will get called whenever new developer app is created in portal. You can implement the hook in custom module & make an API call to your internal system.
Implementing a hook is fairly simple, see steps below.
- A custom module in sites/all/modules/custom , let’s call it plantronics_app_flow
- Create a folder called plantronics_app_flow in sites/all/modules/custom
- Create a file called plantronics_app_flow.info with below code,
name = Plantronics App Custom Workflow
description = Plantronics App Custom Workflow
core = 7.x
package = Plantronics Custom Module
- Create a file called plantronics_app_flow.module with below code**,** which implements above hook. Implementing a hook is nothing but creating a function with module name instead of hook keyword.
function plantronics_app_flow_devconnect_developer_app_save(array $results, array &$form_state) {
// Get App Details
$app_id = $results['data']['appId'];
$entities = entity_load('developer_app', array($app_id));
$entity = reset($entities);
// Extract app data needed
drupal_set_message("<pre>" . print_r($entity, 1) . "</pre>");
$client_id = $entity->credentials[0]['consumerKey'];
$client_secret = $entity->credentials[0]['consumerSecret'];
$app_name = $entity->name;
$callback_url = $entity->callbackUrl;
//Get the endpoint details..
$server_endpoint = 'https://xxxxxxx';
// Make the call to ping..
$payload = '{
"client":[
{
"bypassApprovalPage":"true",
"name":"' . $app_name . '",
"clientId":"'. $client_id .'",
"secret":"' . $client_secret . '",
"grantTypes":[
"authorization_code",
"implicit",
"client_credentials"
],
"restrictScopes":"true",
"restrictedScopes":[
"email",
"openid",
"profile"
],
"redirectUris":["'. $callback_url .'"]
}
]
}';
$auth_header = base64_encode('xxxusername:xxxpassword');
$options = array(
'method' => 'POST',
'data' => $payload,
'timeout' => 15,
'headers' => array('Content-Type' => 'application/json', 'Authorization' => 'Basic ' . $auth_header),
);
$result = drupal_http_request($server_endpoint, $options);
drupal_set_message("<pre>" . print_r($result, 1) . "</pre>");
return TRUE;
}
More about drupal_http_request here.
- Go to admin/modules & enable above custom module you have created.
- Create an app & see it in action.
Hope it helps. I would recommend get a resource with Drupal Expertise to do above workflows.