スポンサーリンク
Apigeeは基本的にフロー(1リクエスト/1レスポンス)に完結して処理が行われます。ですので、複数のフローに渡って情報を受け渡しする場合や同じIPアドレスから連続で来た場合に処理を行う、といったことをやりたい場合には工夫が必要です。
そんな時はKey Value Map Policyを使えば実現できます。
その名の通りですが、キー(名前)とバリュー(値)のペアで変数を保存する機能です。
例えば、Apigeeを使ってユーザ情報を管理するAPIを作りたいと考えた時、以下のような変数を用意すれば実現できます。
Key | Value |
---|---|
Ken | Male,30,Engineer |
Taro | Male,25,Sales |
Hanako | Female,23,Sales |
この画面は以下の手順で確認/作成できます。
APIs => Environment Configuration => Key Value Maps
この画面中の + Key Value Map
ボタンを押せば変数が追加できます。
次にこのKVMを使うポリシーを実際に見てみます。
Key Value Mapsの操作にはKey Value Map Operations
というpolicyを使います。
今回は読込/書込の方法を記載したいと思います。
まず、先程設定したKVMを読み出すポリシーを設定します。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="get_user_info" mapIdentifier="user_info">
<DisplayName>get_user_info</DisplayName>
<ExpiryTimeInSecs>-1</ExpiryTimeInSecs>
<Get assignTo="sex" index="1">
<Key>
<Parameter ref="username"/>
</Key>
</Get>
<Get assignTo="age" index="2">
<Key>
<Parameter ref="username"/>
</Key>
</Get>
<Get assignTo="job" index="3">
<Key>
<Parameter ref="username"/>
</Key>
</Get>
<Scope>environment</Scope>
</KeyValueMapOperations>
このようにすれば変数username
に格納された名前にヒットするユーザの情報を取得することができます。
なお、このポリシーを適用するよりも前のフローでusername変数を定義しておく必要があります。(ExtractVariablesポリシー等を使えばできます。)
次にこの変数の更新の方法です。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<KeyValueMapOperations async="false" continueOnError="false" enabled="true" name="update_user_info" mapIdentifier="user_info">
<DisplayName>update_user_info</DisplayName>
<Put override="true">
<Key>
<Parameter ref="username"/>
</Key>
<Value ref="sex"/>
<Value ref="age"/>
<Value ref="job"/>
</Put>
<Scope>environment</Scope>
</KeyValueMapOperations>
このように書けば、変数username
でヒットしたKeyValueMapの情報を、現在持っているsex
age
job
の情報で更新します。
特に、
<Value ref="sex"/>
<Value ref="age"/>
<Value ref="job"/>
の部分は、この順番でindex(カンマ区切りの順番)が決まるので、注意する必要があります。
以上、apigeeを使う上でよく出てくるKVMの使い方でした。
スポンサーリンク
2022/05/20 22:04:22
2022/05/21 06:51:34
2022/04/07 22:20:27
order cialis online tadalafil cialis
2022/04/08 05:38:41
viagra brand viagra samples
2022/04/08 06:42:57
cost sildenafil how to make sildenafil citrate
2022/04/09 08:45:20
tadalafil professional review 5mg tadalafil
2022/04/09 22:07:42
maxim peptide tadalafil review tadalafil generic date
2022/04/10 01:05:32
viagra price viagra spam buy generic viagra buy viagra no prescription
2022/04/11 19:10:42
canada drugs online hy-vee pharmacy
2022/04/12 02:32:21
sildenafil and alcohol is sildenafil covered by insurance
2022/04/12 03:32:45
northwest canadian pharmacy reviews canadian pharmacies that sell viagra
2022/04/12 23:34:49
buy real viagra from canada viagra from canadian pharmacy
2022/04/13 10:37:16
cialis without a rx buy cialis tadalafil
2022/04/13 18:04:23
how do you pronounce sildenafil sildenafil ingredients
2022/04/13 19:10:03
pet pharmacy prescription drugs in canada
2022/04/14 22:35:48
canada drugs spring hill fl viagra canada online pharmacy
2022/04/15 05:53:48
why are prescription drugs so much cheaper in canada compare rx prices
2022/04/15 11:53:46
levitra list price levitra 20mg vs viagra 100mg
2022/04/16 18:42:12
ambrisentan and tadalafil cheap tadalafil 60 mg
2022/04/16 11:46:57
ivermectin tablets for humans over the counter dr syed haider ivermectin
2022/04/16 21:00:18
ivermectin for dogs dosage in ml ivermectin poisoning
2022/04/18 00:14:01
metoprolol and cialis cialis orders paypal paid
2022/04/18 07:26:11
viagra soft 100mg online canadian pharmacy buy viagra price
2022/04/18 13:26:35
list of prescription drugs available in mexico contrave canadian pharmacy
2022/04/19 20:39:33
levitra success stories levitra savings card
2022/04/20 03:21:34
how long does it take cialis to start working generic cialis online pharmacy
2022/04/20 05:22:03
max dosage of cialis purchase cialis
2022/04/21 06:44:02
cheap generic viagra 100mg canada can you buy female viagra over the counter
2022/04/21 13:47:05
online pharmacy walmart com rx pharmacy
2022/04/21 19:38:37
levitra pricing levitra free trial sample
2022/04/22 16:33:38
2022/04/23 01:04:00
Viagra Oral Jelly canadian pharmacy on line
2022/04/23 07:52:33
carefirst rx pharmacy drugstore
2022/04/23 09:52:07
meridia canadian pharmacy safeway pharmacy (inside safeway)
2022/04/24 11:14:55
cyprus online pharmacy community rx pharmacy warren mi
2022/04/24 18:24:36
buying canadian pharmacy canada drug pharmacy coupon
2022/04/25 00:26:16
Cordarone canadian pharmacy generic viagra
2022/04/29 12:53:33
prescription drugs account for 25% of all healthcare-related costs. canadian pharmacy sarasota https://jzpharmacyukj.com/
2022/04/29 19:36:47
sildenafil forum viagra sildenafil citrate 100mg https://sildenafilkiol.com/
2022/04/29 21:29:26
sildenafil 100mg canadian pharmacy canadian viagra online https://sgiviagraikn.com/
2022/04/30 22:16:38
online pharmacy technician schools zetia canadian pharmacy https://dtupharmyjn.com/
2022/05/01 05:26:47
dog wormer ivermectin ivermectin solution for birds https://stromectolujlo.com/
2022/05/01 11:01:40
how long does levitra 20 mg last viagra vs levitra https://glevitrargu.com/
2022/05/03 15:27:30
levitra 60 mg is levitra safe https://xclevitradb.com/
2022/05/03 23:39:09
Aldactone my canadian pharmacy rx reviews
2022/05/05 00:32:28
cialis 200 mg. what is the cost of cialis https://dccialisxvf.com/
2022/05/05 07:23:21
viagra prescription medicine sildenafil cheapest price https://aviagrasbt.com/
2022/05/09 09:32:38
levitra time levitra 20mg filmtabletten preisvergleich https://xclevitradb.com/
2022/05/09 15:57:01
how to make sildenafil voguel sildenafil 100mg https://sildenafilkiol.com/
2022/05/09 16:10:17
hydroxichloriquin hydroxychloroquine biden
2022/05/09 17:39:56
best online pharmacy reviews imitrex canadian pharmacy
2022/05/10 14:26:26
2022/05/10 17:58:14
cialis reviews photos cialis online buy https://dccialisxvf.com/
2022/05/11 00:57:32
where can i buy sildenafil over the counter viagra soft sale https://aviagrasbt.com/
2022/05/11 05:49:16
levitra vardenafil 20 mg generic levitra vardenafil 20mg https://glevitrargu.com/
2022/05/13 00:32:10
buy modafinil 100mg online modafinil brand
2022/05/13 17:11:13
how to write a draft dissertation help
cheap dissertation help in dallas
dissertation writing service
2022/05/14 11:56:31
levitra online amazon sildenafil 20 mg vs levitra https://xclevitradb.com/
2022/05/14 15:25:23
do my dissertation
dissertation example
dissertation online
2022/05/14 18:29:10
50 mg sildenafil does generic sildenafil work https://sildenafilkiol.com/
2022/05/14 20:18:24
list of trusted canadian pharmacies price of prescription drugs
2022/05/15 10:27:35
help with phd dissertation
best dissertation writing help new york
english literature dissertation help
2022/05/16 09:19:28
generic for levitra what does levitra do https://glevitrargu.com/
2022/05/16 09:39:14
premium dissertation writing service
uf thesis and dissertation
masters dissertation writing
2022/05/17 18:51:28
best dissertation writing help chicago
dissertation help tutors
uchicago dissertation office
2022/05/18 11:48:55
order modafinil 100mg online cheap modafinil order modafinil cheap
2022/05/18 15:10:23
levitra online levitra patent expiration date us https://xclevitradb.com/
2022/05/18 17:05:46
buy modafinil 200mg buy provigil 100mg without prescription
2022/05/18 21:38:25
sildenafil generic viagra edegra sildenafil https://sildenafilkiol.com/
2022/05/18 21:52:17
modafinil 200mg ca order modafinil for sale
2022/05/18 23:27:36
family pharmacy 24 hr pharmacy near me
2022/05/19 02:15:36
erythromycin uses erythromycin eye ointment for newborns
2022/05/19 05:32:17
provigil order buy provigil 100mg online
2022/05/19 19:30:24
buy provigil 200mg pills order provigil 200mg sale
2022/05/19 22:03:33
dissertation help online uk
dissertation editors near me
dissertation writing service atlanta ga
2022/05/19 23:50:55
cialis reliable sites cialis 10 mg where to buy https://dccialisxvf.com/
2022/05/20 06:59:15
otc viagra united states online viagra from canada https://aviagrasbt.com/
2022/05/20 12:22:53
levitra patent expiry date levitra us https://glevitrargu.com/
2022/05/20 16:28:08
buy generic provigil provigil 100mg cost purchase provigil