{
"error": {
"code": "<some internal code or text like btp.apmgmt.auth.MissingApiKey>",
"message": "Missing APIKey header. Please provide an APIKey in the request header for authentication."
}
}
<faultRules>
<faultRule>
<name>APIKeyErrors</name>
<condition>(oauthV2.VK-VerifyAPIKey.failed = true)</condition>
<steps>
<step>
<policy_name>AM-FaultRuleInvalidAPIKey</policy_name>
<condition>(fault.name = "InvalidApiKey")</condition>
<sequence>0</sequence>
</step>
<step>
<policy_name>AM-FaultDeveloperStatusNotActive</policy_name>
<condition>(fault.name = "DeveloperStatusNotActive")</condition>
<sequence>0</sequence>
</step>
<step>
<policy_name>AM-FaultRuleNoAPIKey</policy_name>
<condition>(fault.name = "FailedToResolveAPIKey")</condition>
<sequence>0</sequence>
</step>
</steps>
</faultRule>
<faultRule>
<name>QuotaViolationErrors</name>
<condition>(ratelimit.QT-RateLimit.failed = true)</condition>
<steps>
<step>
<policy_name>AM-FaultRuleQuotaViolation</policy_name>
<condition>(fault.name = "QuotaViolation")</condition>
<sequence>0</sequence>
</step>
</steps>
</faultRule>
</faultRules>
<AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
<Set>
<StatusCode>429</StatusCode>
<ReasonPhrase>Too many requests</ReasonPhrase>
<Headers>
<Header name="Retry-After">{ratelimit.QT-RateLimit.expiry.time}</Header>
</Headers>
</Set>
<AssignVariable>
<Name>custom.error.code</Name>
<Value>btp.apmgmt.quota.QuotaViolation</Value>
</AssignVariable>
<AssignVariable>
<Name>custom.error.message</Name>
<Value>The Quota limit has been reached. Please try again later.</Value>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
<defaultFaultRule>
<name>defaultfaultRule</name>
<alwaysEnforce>true</alwaysEnforce>
<steps>
<step>
<policy_name>JS-FaultRuleSetErrorVariables</policy_name>
<sequence>0</sequence>
</step>
<step>
<policy_name>AM-FaultRuleToXML</policy_name>
<condition>(request.header.accept = "application/xml")</condition>
<sequence>1</sequence>
</step>
<step>
<policy_name>AM-FaultRuleToJSON</policy_name>
<condition>(request.header.accept = "application/json")</condition>
<sequence>2</sequence>
</step>
<step>
<policy_name>AM-FaultRuleToPlaintext</policy_name>
<condition>(request.header.accept = null) or ((request.header.accept != "application/json") and (request.header.accept != "application/xml"))</condition>
<sequence>3</sequence>
</step>
</steps>
</defaultFaultRule>
var customErrorMessage = context.getVariable("custom.error.message");
if (!customErrorMessage) {
var errorMessage = context.getVariable("error.message");
context.setVariable("custom.error.message", errorMessage);
}
var customErrorCode = context.getVariable("custom.error.code");
if (!customErrorMessage) {
context.setVariable("custom.error.code", "btp.apmgmt.InternalError");
}
<AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
<Set>
<Payload contentType="application/json" variablePrefix="@" variableSuffix="#">
{
"error": {
"code": "@custom.error.code#",
"message": "@custom.error.message#"
}
}
</Payload>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
<AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'>
<Set>
<Payload contentType="application/xml" variablePrefix="@" variableSuffix="#">
<error>
<code>@custom.error.code#</code>
<message>@custom.error.message#</message>
</error>
</Payload>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>
<RaiseFault async="false" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">
<FaultResponse>
<AssignVariable>
<Name>custom.error.code</Name>
<Value>btp.apmgmt.MethodNotAllowed</Value>
</AssignVariable>
<AssignVariable>
<Name>custom.error.message</Name>
<Value>The ressource you tried to access does respond to the used http method.</Value>
</AssignVariable>
<Set>
<StatusCode>500</StatusCode>
<ReasonPhrase>Method Not Allowed</ReasonPhrase>
</Set>
</FaultResponse>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
</RaiseFault>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
11 | |
8 | |
7 | |
5 | |
4 | |
4 | |
4 | |
3 |