How to pass developer, developer app information among Apigee Edge, Apigee Developer Portal and my system in developer registration process

Not applicable

My system also need to have the developer and developer app information information that is stored at Apigee Edge cloud, so that when my system gets a request from Apigee Edge cloud, it can return data that belongs to that developer instead of data belong to other developer's.

I can think of two ways of doing it

  • Use my own developer/app registration portal to register developer and app then call Apigee administration APIs to create developer and developer app, after getting response from Apigee, update our database to set up the mapping. The question is how to support the developer portal sign up and make it a seamless process?
  • Use Apigee portal to register developer and app then push the same information to Apex and set up the mapping. The question is how to implement the push in Apigee Edge or Portal?
  • Are there alternatives other than storing developer information in both systems?

Thanks!

2 12 1,867
12 REPLIES 12

Hi @songwen xie ,

When you say that your system needs "the developer and developer app information information that is stored at Apigee Edge cloud", what information are you referring to? Would that be the developer's name and email address? the name of the app?

This information is available to the API Proxy flow, after a VerifyApiKey policy, or after a VerifyAccessToken policy. At that point, the API proxy flow could inject a header into the request that is going to your backend, which contains this data.

When a developer uses the developer portal to register himself, and then create an app, this results in the creation of a developer entity in Apigee Edge, and then the creation of an app associated to that developer. The app is a key pair (client id and client secret) and a name, eg "App1" or whatever the developer has chosen.

At runtime, when the app sends an API request, if your API uses API key verification, then Apigee Edge automatically retrieves the name of the developer app for that client id, and can also retrieve the name and email of the developer . These data items are set into context variables that are available for any subsequent policy in the proxy flow. Something similar happens when the app uses an OAuth token.

To retrieve the developer name and email, you would need an AccessEntity policy, like this:

<AccessEntity name="GetDev">
  <EntityType  value="developer"/>
  <EntityIdentifier ref="developer.id" type="developerid"/> 
</AccessEntity>

The result is stored into a variable with a name derived from the policy name. In this case the variable is AccessEntity.GetDev. The resulting data is in XML format. To extract just the email you may wish to use an ExtractVariables policy, like so:

<ExtractVariables name="SetDeveloperProfile">
  <Source>AccessEntity.GetDev</Source> 
  <VariablePrefix>dev</VariablePrefix>
  <XMLPayload>
    <Variable name="email" type="string">
      <!-- parse an element from the developer profile using XPath. -->
      <XPath>/Developer/Email</XPath>
    </Variable>
  </XMLPayload>
</ExtractVariables>

You could then use AssignMessage to inject the necessary header into the request that will be sent to the backend:

<AssignMessage name='AssignMessage-1'>
  <AssignTo createNew='false' type='request'/>
  <Set>
    <Headers>
      <Header name='X-developerid'>{developer.id}</Header>
      <Header name='X-developeremail'>{dev.email}</Header>
    </Headers>
  </Set>
</AssignMessage>

Your backend would then receive the headers X-developerid and X-developeremail.

This is covered in the doc for AccessEntity: http://apigee.com/docs/api-services/reference/access-entity-policy

I need developer.id or dev.email in my system during registration process. So using AssignMessage method to pass developer.id and dev.email. to the backend, the backend can insert/retrieve data belong to that developer.

I see - you want the dev.email or developer ID during registration. Currently there is no webhook or other notification by which Edge notifies your systems that a developer has been registered. However, you could poll Edge and inquire developers periodically. There is an administrative API that you can use to inquire the developers that have registered and the apps they have created.

Could you register developers "just in time"? In other words, could you create your logic so that the first time it receives an inbound message from Edge with the X-developerid header, you register the developer then? What other information about the developer will you store in your backend, and where will you get it?

@Dino I think "just in time" is a great idea! - client can send request through Edge only after developer account has been approved(become active) and developer app has been approved. It should be OK, I don't see any security concerns to automatically add user this way. Do you agree?

On your first suggestion, does portal admin get email notification on each user registration or app created? If so, portal admin can approve registration from portal - approve developer/app status to active, I guess there is no notification/web hook during approval process. so at least he can go to my backend portal to initiate the process to add developer using Apigee admin APIs.

As for What other information about the developer will you store in your backend, and where will you get it? I may need developer app information from Apigee.

I think you have covered my second question in my original post. Can you please take a look of my first and third question? Thanks!

As for the original Q#1,

you can invoke APIs on the Apigee Edge Administrative server to create developers, set their approval status, create applications, and attach arbitrary meta-data to those developers and apps. For example:

Create a Developer

Set Developer Status

Set custom attributes on a developer

Create an App for a developer

Approve or Revoke a developer app

So, if I understand the question, the answer is, yes, you can create your own developer portal, building upon these APIs to create your own developer registration process and workflow.

Alternatively, you could customize the developer portal provided by Apigee. There is a drupal hook that gets called for each developer that registers. You could provide your own PHP code that invokes your backend with whatever information is appropriate.

For Q#3, yes, the obvious alternative to storing information in both systems is for your backend system to rely on Apigee Edge as the system-of-record for registered developers.

Dear @songwen xie ,

Welcome to Apigee Community 🙂

It's possible. Please find details below.

  • I assume source of Developers / Developer Apps are originated from Apigee Developer Portal built on top of famous Drupal CMS.
  • Many of our customers integrated their own systems with Developer Portal to solve use cases that needs their existing system integration with APIs.
  • Using your own developer/app registration portal and registration is not a great thing since you will miss lot of feature that we provide out of the box from Apigee Developer Portal like SmartDocs etc.

You can push information from Apigee Developer Portal to your system using Drupal Hooks by implementing them in Drupal Custom Module. For Example, Apigee Developer Portal built on top of Drupal provides Drupal hooks like hook_user etc which will be used to capture information when user created. Similar hooks are available for Apps etc in Apigee Developer Portal.

You need to push information from Apigee Developer Portal to your system using APIs. Your existing system should expose APIs which will be called from Apigee Developer Portal. Information will be pushed directly from Apigee Developer Portal to your system without intervention of Apigee Edge.

You need little bit of Drupal Expertise to achieve above. It's simple and straight forward.

Cheers,

Anil Sagar

@songwen xie , Let us know what do you think about above solution ? Does it solve your use case ?

@Anil Sagar I was exactly looking for this answer. Can you point to any documentation to get comfortable doing this ? (Apigee Developer Portal to your system using Drupal Hooks by implementing them in Drupal Custom Module) Thanks!

@manojramakrishnan , You need little bit of Drupal expertise for this. Take a look at profiles/apigee/modules/devconnect & *.api.php files inside the module to find out different drupal hooks. I will try to put together an article that explains same soon.

Can you guys ask/answer this topic in a new thread please? Rather than resurrecting a thread that is 2 years old... Just ask a new question and refer to THIS ONE in the new one. It makes it easier for others who are searching.

Another tangential question - If I choose from my side to get app and developer, can I get the app and developer information from ApiGee management API?

Yes, You can. Explore Apigee Management APIs here.