Explore API Management Flashcards

(26 cards)

1
Q

What does API Management (APIM) provide?

A
  • core functionality to ensure a successful API program through dev engagement, business insights, analytics, security and protection
  • devs subscribe to a product that contains an API, then they cna call the APIs operation, subject to any usage policies that may be in effect
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is APIM made up of?

A
  • API gateway, management plane and a dev portal
  • all azure hosted and fully managed by default
  • available in different tiers which vary in capacity and features
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is API gateway?

A

Endpoint that…
-Accepts API calls and routes them to appropriate backends
- verifies API keys and other credentials presented with requests
- enforces usage quotas and rate limits
- transforms request and responses specified in policy statements
- caches responses to imrpvoe response latency and minimise the load on the backend service
emits logs, metrics and traces for monitoring, reporting and troubleshooting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the management plane on APIM, what can we use it for?

A

Admin interface where you set up your API program and use it to…
- provision and configure API mgmt service settings
- define or import API schema
- package APIs into products
- set up policies like quotas or transformations on the APIs
- get insights from analytics
- manage users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the developer portal in terms of APIM?

A

Auto generated, fully customisable website with the docs of your API where devs can…
- reads docs
- call API via interactive console
- create an account and sub to get API keys
- access analytics on their own usage
- download API definitions
- manage API keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are products in APIM?

A
  • How APIs are surfaced to devs
  • Have one or more APIs and are configured with a title, description and T&Cs
  • can be open or protected
  • protected must be subscribed to before they can be used
  • sub approval is configured at the product level and can either require admin approval or be auto approved
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the 3 groups in APIM?

A

Used to manage visibility of products to devs
- Admins = Manage API mgmt, create APIs and products
- Developers = Authenticated dev p[ortal users that build apps using APIs, can access dev portal
- Guests = unauthenticated dev portal uses, can be granted read-only access so view APIs but not call them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are developers in APIM?

A
  • represent the user accounts in APIM instance
  • can be created or invited to join by admins or can sign up from dev portal
  • each dev is a member of one or more groups and can subscribe to the products that grant visibility to those groups
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are policies in APIM?

A
  • collection of statements which in turn contain expressions that are executed sequentially on the request or response of an API
  • e.g. format conversion from XML to JSON or call rate limiting to restrict number of incoming calls from a dev
  • can be applied at different scopes (global, product, specific API or specific API operation)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are policy expressions in APIM?

A
  • can be used as attribute values or test values in any of the APIM policies unless the policy says otherwise
  • some policies such as “control flow” and “set var” are based on policy expressions
  • single C# statement enclosed in a @(expression) or multi statement C# code block enclosed in a @{expression} that returns a value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the API gateway manage?

A
  • responsible for proxying API requests, applying policies and collecting telemetry
  • decouples client from the services
  • sits between clients and services acting as a reverse proxy by routing requests from clients to services
  • may also perform cross-cutting tasks such as auth, SSL termination and rate limiting
  • if you dont deploy a gateway clients must send requests directly to back-end services
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the issues with exposing services directly to clients in relation to APIM?

A
  • can lead to complex client code as client has to keep track of multiple endpoints and handle failures in a resilient way
  • creates coupling between client and backend
  • single operation might require calls to multiple services
  • services with public endpoints are a potential attack surgace
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the managed APIM gateway?

A
  • default component that is deployed in Azure for every APIM instance in every service tier
  • all API traffic flows through azure regardless of where backends implementing the APIs are hosted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is self hosted APIM gateway?

A
  • optional, containerised version of default gateway thats useful for hybrid and multicloud scenarios
  • Enables customers with hybrid IT infra to manage APIs hosted on prem and across clouds from a single APIM service in azure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What do APIM policies allow?

A
  • publisher to change the behaviour of the API through config
  • applied inside the gateway that sits between the API consumer and the managed API
  • Can apply changes to requests and response inside the gateway before passing onto the API/Client
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an APIM policy defintion?

A
  • XML that describes a sequence of inbound and outbound statements

<policies>
<inbound>statements to be applied to request go here</inbound>
<backend>statements to be applied before the request is forwarded to backend go here</backend>
<outbound>statements to be applied to the response go here</outbound>
<on-error>statements to be applied if theres an error go here</on-error>
</policies>

17
Q

what is the context var in terms of policy expressions in APIM?

A
  • each expression has access to the var and an allowed subnet of the .NET framework types
  • provides a sophisticated means to control traffic and modify API behaviour without requiring you to write specialised code or modify backend services
18
Q

Example of a policy statement that adds user data to incoming request

A

<policies>
<inbound>
<base></base>
<set-header>
<value>@(context.User.Id)</value>
<value>@(context.Deployment.Region)</value>
</set-header>
</inbound>
</policies>

19
Q

what is the <base></base> tag in policy statement?

A
  • allows for ordering of statements
  • anything before that element executes first, then anything after that element executes
20
Q

What is control flow in APIM policies?

A
  • conditionally applies policy statements based on the results of the evaluation of boolean expressions
  • <choose> applies enclosed policy statements based on the outcome of expressions (if-then-else)
    </choose>

<choose>
<when>...</choose>
<when>...</choose>
<otherwise>…</otherwise>
</choose>
</when></when></choose>

21
Q

What is a forward request in APIM policies?

A
  • Forwards the request to the backend service
  • backend service URL is specified in the API settings
  • policies in the outbound section are evaluated immediately upon the successful completion of the policies in the inbound section

<forward-request></forward-request>

22
Q

What is the limit concurrency tag in APIM policies?

A
  • Prevents enclosed policies from executing by more than the specified number of requests at a time
  • when requests exceed the limit they fail with 429 too many requests

<limit-concurrency>…</limit-concurrency>

23
Q

What is the log to event hub tag in APIM policies?

A
  • sends msgs in the specified format to an event hub defined by a logger entity
  • used to save selected requests or response context info for online or offline access

<log-to-event-hub>Expression returning a string to be logged</log-to-event-hub>

24
Q

What is the mock response tag in APIM policies?

A
  • Aborts pipeline execution and returns a mock response directly to the caller
  • prefers response content example whenever available
  • Generates sample responses from schemas when provided and examples if no schemas

<mock-response></mock-response>

25
What is Retry tag in APIM policies?
- Retries execution of the enclosed policy statements if and until the condition is met - Repeats at specified time intervals and up to the specified retry count
26
What is return response tag in APIM policies?
- Aborts pipeline execution and returns either a default or custom response to the caller - Default is 200 ok with no body