我们打开 SAP Commerce Cloud SmartEdit 时,能观察到下面的 OCC API:
完整的请求 url: https://localhost:9002/previewwebservices/v1/preview
这个 previewwebservices 是 SmartEdit 正常运行必须的 extension 之一。
在 response 的结构里有一个叫做 ticketId 的字段。
稍后这个 ticket 作为请求的 query 参数:
OCC 请求里有了 cmsTicketId 字段后,在 HTTP 响应里就会多出 smartEdit
的动态属性。
预览 API 使得 SmartEdit 能够将商店加载到所请求的体验上下文的 iframe 中。体验上下文是特定站点、目录和目录版本的商店,也可以是指定的语言和日期时间。
-
为了在指定的体验上下文中呈现商店,SmartEdit 将所请求的商店加载到所请求的体验上下文的 iframe 中。
-
为了加载所请求的体验上下文中的商店,SmartEdit 框架执行以下操作:
-
发送所请求的体验上下文的 POST 请求到预览 API 并从中获取预览票证 ID。
-
使用附加了 /cx-preview 的 URI 以及一个 cmsTicketId 请求参数,该参数的值为预览票证 ID,调用体验上下文的商店主页。
-
加载所请求的页面到 iframe 中。
以下有效载荷必须发布到 /previewwebservices/v1/preview:
{
"catalog":"apparel-ukContentCatalog",
"catalogVersion":"Staged",
"language":"en",
"resourcePath":"/the/path/to/my/storefront/site"
"time": "2016-12-20T08:51:36-0500",
"catalogVersions" : [{
"catalog" : "apparelProductCatalog",
"catalogVersion" : "Online"
}, {
"catalog" : "apparel-ukContentCatalog",
"catalogVersion" : "Staged"
}]
}
例子:
如果一个主页的URL是 ·/the/path/to/my/storefront/site·,那么你的店面也应该支持 ·URL /the/path/to/my/storefront/site/cx-preview?cmsTicketId=<preview_ticket_id>·。第二个URL必须为由预览票证ID标识的经验上下文提供店面站点。一旦在主页上调用了这个URL,即使在URL中没有添加 /cx-preview 或 cmsTicketId,任何深度链接或直接访问其他页面也必须提供相同的经验上下文。
- previewwebservices Commerce 用途 Cloud SAPpreviewwebservices commerce用途cloud footernavigationcomponent commerce cloud sap commerce cloud sap commerce模式cloud sap dataisolation commerce cloud flag webapplicationinjector smartedit commerce cloud 脚本commerce问题cloud smartedit commerce模式cloud webservices smartedit commerce cloud commerce目的license cloud