{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
3
Question by Michael Russo · Apr 01, 2015 at 02:38 AM · 3.4k Views apigee edgeapi management

Does Edge generate a unique ID for each API request?

I need a unique ID generated for logging/troubleshooting purposes and wanted to check if there was one already available from Edge instead of generating a custom one with a policy.

Comment
Add comment
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Close

1 Answer

  • Sort: 
avatar image
5
Best Answer

Answer by Michael Russo   · Apr 01, 2015 at 02:40 AM

There's a flow variable, messageid, that's available for use and contains a unique identifier for each API request. This messageid is used in Edge application logs and can be useful for troubleshooting issues without knowing where they originate. Below is an example policy which adds the ID to a request header before sending to a backend service:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage enabled="true" continueOnError="true" async="false" name="setUniqueIdHeader" type="request">
    <Set>
        <Headers>
            <Header name="x-request-id">{messageid}</Header>
        </Headers>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

Note: I set continueOnError to true because I don't want this policy, for any reason, to stop API request processing.

By adding this ID to a request header before the request is sent to the backend service, you allow any backend APIs to extract the ID and log it as well. You now have a trace for each API request from the edge to the backend service.

For more information on Edge predefined variables, check out the doc page @ http://apigee.com/docs/api-services/reference/variables-reference#requestmessagevariables

Comment
Add comment Show 3 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sgilson ♦♦ · Apr 01, 2015 at 01:14 PM 0
Link

Here is the doc page on messageid: http://apigee.com/docs/api-services/reference/variables-reference

Stephen

avatar image Akash Prabhashankar ♦ · Aug 30, 2017 at 03:54 AM 0
Link

@Michael Russo Can this message ID be configured to suppress the router hostname which it contains?

avatar image Akash Prabhashankar ♦ · Aug 31, 2017 at 04:07 AM 0
Link

OK. I could confirm that unfortunately this will not be possible because that messageId is constructed in the router code and attempting this might break the random/unique nature of it.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error in deployment ScriptEngine for jsc or py not found 1 Answer

How to use custom attributes in Apigee Edge? 3 Answers

How to deploy multiple proxy End points in one proxy? 1 Answer

Anyone using Apigee Edge to proxy AWS Services (EC2 / Lambda / S3 ) ? 1 Answer

bundle-linter enhancement 2 Answers

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges