You can use the Store API on the administration server to access your store in preview mode. This requires a multi-step authentication procedure.

First, log into the Admin API on the administration server using an account that has the Administrator role. Issue a POST request to the /ccadmin/v1/mfalogin endpoint, and include the username, password, and passcode in the body of the request. For example:

POST /ccadmin/v1/mfalogin HTTP/1.1
Content-Type: application/x-www-form-urlencoded

grant_type=password&username=admin1@example.com&password=A3ddj3w2&totp_code=443589

The response returned includes an access token:

{
    "token_type": "bearer",
    "access_token": "<access_token>"
}

Next, create a new preview user by issuing a POST request to /ccstore/v1/profiles on the administration server. (You can skip this step if you have previously created a preview user.) In the authorization header field of the request, pass in the access token that was returned by /ccadmin/v1/mfalogin:

POST /ccstore/v1/profiles HTTP/1.1
Authorization: Bearer <access_token>

In the body of the request, specify the values of the profile properties, as described in Create a shopper profile.

Now log in as the preview user by issuing a POST request to the /ccstore/v1/login endpoint on the administration server. Include the username and password in the body of the request. In addition, in the authorization header field of the request, pass in the access token that was returned by /ccadmin/v1/mfalogin:

POST /ccstore/v1/login HTTP/1.1
Authorization: Bearer <access_token>
Content-Type: application/x-www-form-urlencoded

grant_type=password&username=previewuser@example.com&password=Test1234

The response returned by /ccstore/v1/login includes a new access token:

{
    "token_type": "bearer",
    "access_token": "<access_token_2>"
}

You can now make requests to the /ccstore/v1 endpoints on the administration server, passing in <access_token_2> (the access token that was returned by /ccstore/v1/login). You can also use the original access token (returned by /ccadmin/v1/mfalogin) to access /ccadmin/v1 endpoints and to create preview users with the /ccstore/v1/profiles endpoint.

Note that if your Commerce Cloud instance is running multiple sites, preview requires a specific site context. You can specify the site when you log in as a preview user and in subsequent calls to the Store API. If you do not specify a site, the default site is used. See Use the APIs on instances running multiple sites for information about specifying the site in API calls.


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices