InvalidMessageWeight
エラーコード
policies.ratelimit.InvalidMessageWeight
    エラー レスポンスの本文
{
        "fault": {
            "faultstring": "Invalid message weight value [invalid_value]",
            "detail": {
                "errorcode": "policies.ratelimit.InvalidMessageWeight"
            }
        }
    }
    エラー メッセージの例
{
        "fault": {
            "faultstring": "Invalid message weight value 1.5",
            "detail": {
                "errorcode": "policies.ratelimit.InvalidMessageWeight"
            }
        }
    }
    原因
このエラーは、フロー変数で <MessageWeight> 要素に無効な値(整数以外の値)が指定された場合に発生します。
たとえば、フロー変数で <MessageWeight> 要素の値として 1.5(整数以外の値)が指定されると、このエラーが発生します。
診断
- 割り当てポリシー内で - <MessageWeight>要素に使用されている無効な値を確認します。この情報はエラー レスポンスの- faultstring要素で調べることができます。たとえば、次のエラーでは、- <MessageWeight>要素に使用されている無効な値は- 1.5です。- "faultstring": "Invalid message weight value 1.5"
- エラーが発生した特定の API プロキシで、すべての割り当てポリシーを調べます。 - <MessageWeight>要素が指定されている割り当てポリシーが 1 つ以上存在する可能性もあります。- たとえば、次のポリシーではフロー変数 - message_weightを使用して- <MessageWeight>を指定します。- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Quota async="false" continueOnError="false" enabled="true" name="Quota_with_weight" type="calendar"> <DisplayName>Quota_with_weight</DisplayName> <Properties/> <Allow count="3"/> <Interval>1</Interval> <TimeUnit>minute</TimeUnit> <StartTime>2017-7-16 12:00:00</StartTime> <MessageWeight ref="message_weight"/> </Quota>
- 識別した割り当てポリシー内で - <MessageWeight>に使用されている変数の値を確認します。このフロー変数の値は、HTTP ヘッダー、クエリ、パラメータ、XML または JSON リクエスト ペイロードから抽出されることも、別のポリシーで定義されていることもあります。- API プロキシ バンドルのコード内で、最初にその変数が定義された場所を特定します。
- 変数が定義されているポリシーを特定したら、その変数の値がどのように設定されるのか調べます。
- フロー変数の値が上記のステップ 1 で特定した値と一致している場合、これがエラーの原因です。
 - たとえば、割り当てポリシーの開始前に使用される JavaScript ポリシーで、次のようにリクエストのタイプに応じて変数 - message_weightの値が設定されるとします。- var verb = context.getVariable("request.verb"); context.setVariable("message_weight", "1.5"); if (verb == 'POST') { context.setVariable("message_weight", "2"); }- 変数 - message_weightの値は- 1.5ですが、これは無効な(整数以外の)値です。
解決策
フロー変数で指定された MessageWeight を表す値が有効な値(整数値)になるようにします。
上記の例を修正するには、JavaScript に含まれる変数 message_weight の値が整数になるように変更します。
var verb = context.getVariable("request.verb");
    context.setVariable("message_weight", "1");
    if (verb == 'POST') {
      context.setVariable("message_weight", "2");
    }
    FailedToResolveQuotaIntervalReference
エラーコード
policies.ratelimit.FailedToResolveQuotaIntervalReference
    エラー レスポンスの本文
{
        "fault": {
            "faultstring": "Failed to resolve quota interval reference [reference] in quota policy {1}",
            "detail": {
                "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalReference"
            }
        }
    }
    エラー メッセージの例
{
        "fault": {
            "faultstring": "Failed to resolve quota interval reference api.product.developer.quota.interval in quota policy {1}",
            "detail": {
                "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalReference"
            }
        }
    }
    原因
このエラーは、割り当てポリシー内で <Interval> 要素が定義されていない場合に発生します。この要素は必須であり、割り当ての対象期間を指定するために使用されます。この期間は、<TimeUnit> 要素で定義された分数、時間数、日数、週数、または月数として定義できます。
診断
- エラーが発生した API プロキシで、すべての割り当てポリシーを調べます。必須の - <Interval>要素が定義されていない割り当てポリシーがあれば、それがエラーの原因です。- たとえば、次の割り当てポリシーには必須の - <Interval>要素が定義されていません。- <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar"> <DisplayName>CheckQuota</DisplayName> <Properties/> <Allow count="3"/> <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit> <StartTime>2017-7-16 12:00:00</StartTime> </Quota>- 上記の割り当てポリシーには必須の - <TimeUnit>要素が定義されていないため、このエラーコードを受け取ります。- policies.ratelimit.FailedToResolveQuotaIntervalReference
解決策
所定の API プロキシのすべての割り当てポリシーに、必須の <Interval> 要素が定義されるようにします。
上記の例を修正するには、次に示す <Interval> 要素が含まれるようにポリシーを変更します。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar"> <DisplayName>CheckQuota</DisplayName> <Properties/> <Allow count="3"/> <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit> <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval> <StartTime>2017-7-16 12:00:00</StartTime> </Quota>
FailedToResolveQuotaIntervalTimeUnitReference
エラーコード
policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference
    エラー レスポンスの本文
{
        "fault": {
            "faultstring": "Failed to resolve quota time unit reference [reference] in quota policy {1}",
            "detail": {
                "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"
            }
        }
    }
    エラー メッセージの例
{
        "fault": {
            "faultstring": "Failed to resolve quota time unit reference apiproduct.developer.quota.timeunity in quota policy {1}",
            "detail": {
                "errorcode": "policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"
            }
        }
    }
    原因
このエラーは、割り当てポリシー内で <TimeUnit> 要素が定義されていない場合に発生します。この要素は必須であり、割り当てに適用する時間単位を指定するために使用されます。期間は、分数、時間数、日数、週数、月数として定義できます。
診断
- エラーが発生した API プロキシで、すべての割り当てポリシーを調べます。必須の - <TimeUnit>要素が定義されていない割り当てポリシーがあれば、それがエラーの原因です。- たとえば、次の割り当てポリシーには必須の - <TimeUnit>要素が定義されていません。- <Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar"> <DisplayName>CheckQuota</DisplayName> <Properties/> <Allow count="3"/> <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval> <StartTime>2017-7-16 12:00:00</StartTime> </Quota>- 上記の割り当てポリシーには必須の - <TimeUnit>要素が定義されていないため、このエラーコードを受け取ります。- policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference
解決策
所定の API プロキシのすべての割り当てポリシーに、必須の <TimeUnit> 要素が適切に定義されるようにします。
上記の例を修正するには、次に示す <TimeUnit> 要素が含まれるようにポリシーを変更します。
<Quota async="false" continueOnError="false" enabled="true" name="CheckQuota" type="calendar"> <DisplayName>CheckQuota</DisplayName> <Properties/> <Allow count="3"/> <TimeUnit ref="verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit">hour</TimeUnit> <Interval ref="verifyapikey.verify-api-key.apiproduct.developer.quota.interval">1</Interval> <StartTime>2017-7-16 12:00:00</StartTime> </Quota>