在Apigee中,可以使用ProxyEndpoint的PreFlow或PostFlow策略来将REST端点路径映射为自定义路径。以下是一个示例解决方法:
CustomPathMapping
CustomPathMapping
request.path == "/custompath"
targetEndpoint
proxy.pathsuffix MatchesPath "/custompath/**"
RestoreOriginalPath
response.status.code == "200"
CustomPathMapping
jsc://CustomPathMapping.js
var originalPath = context.getVariable("request.path");
var customPath = "/custompath" + originalPath;
context.setVariable("request.path", customPath);
RestoreOriginalPath
jsc://RestoreOriginalPath.js
var customPath = context.getVariable("response.proxy.pathsuffix");
var originalPath = customPath.substring("/custompath".length);
context.setVariable("response.proxy.pathsuffix", originalPath);
通过以上步骤,你可以将Apigee中的REST端点路径映射为自定义路径,并在后续流程中使用自定义路径进行处理。