我想在APIGEE中为每个用户启用API配额。我一直试图在这方面采取一些措施,我在APIGEE网站上获得的信息非常少,因为基于类的动态配额。 您能否提供一步一步的程序来启用基于类的动态配额中的每用户配额策略?
谢谢,
答案 0 :(得分:0)
您需要做的就是在配额政策中指定用户特定的变量。如果您正在使用OAuth,则可以在生成令牌策略中设置属性,如此
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-Gen-Token">
<DisplayName>OAuth Gen Token</DisplayName>
<FaultRules/>
<Properties/>
<Attributes>
<Attribute name="userid" ref="request.formparam.login" display="false"/>
</Attributes>
<Operation>GenerateAccessToken</Operation>
<ExpiresIn>86400000</ExpiresIn>
<SupportedGrantTypes>
<GrantType>password</GrantType>
</SupportedGrantTypes>
<GrantType>request.formparam.grant_type</GrantType>
<UserName>request.formparam.login</UserName>
<PassWord>request.formparam.login</PassWord>
<Scope>request.formparam.scope</Scope>
<GenerateResponse/>
</OAuthV2>
&lt; Attribute name =“userid”ref =“request.formparam.login”display =“false”/&gt;成为该用户的唯一变量。当您将Access令牌验证为名为accesstoken.userid
的变量时,将填充它然后使用该变量定义您的配额:
<Quota async="false" continueOnError="false" enabled="true" name="Quota">
<DisplayName>Quota</DisplayName>
<FaultRules/>
<Properties/>
<Identifier ref="accesstoken.userid"/>
<Allow count="2000" countRef="apiproduct.developer.quota.limit"/>
<Interval ref="apiproduct.developer.quota.interval">30</Interval>
<Distributed>true</Distributed>
<Synchronous>false</Synchronous>
<TimeUnit ref="apiproduct.developer.quota.timeunit">minute</TimeUnit>
<AsynchronousConfiguration>
<SyncIntervalInSeconds>20</SyncIntervalInSeconds>
<SyncMessageCount>5</SyncMessageCount>
</AsynchronousConfiguration>
</Quota>
然后,您的配额将在&lt; Identifier ref =“accesstoken.userid”/&gt;上递增。每个用户应该是唯一的。
答案 1 :(得分:0)
I have created OAuth parameters as suggested. Then i got a error in API console as follows to retrieve token:
ErrorCode: invalid_request",Error:Required param : grant_type.
I think, we have give values for this parameters in API console
<GrantType>request.formparam.grant_type</GrantType>
<UserName>request.formparam.login</UserName>
<PassWord>request.formparam.login</PassWord>
<Scope>request.formparam.scope</Scope>
<GenerateResponse/>
How to pass value for UserName, Password and Scope values as there are chile elements for Granttype parent element.