You can configure your system to send a shopper to a particular URL when the shopper enters a particular search term. The URL can represent a static page in your application (such as an "About Us" page) or a specific search or navigation state. This type of configuration is known as a keyword redirect. You can configure any number of search terms to redirect the shopper to a particular URL.
This section describes keyword redirects and how to export, create, replace, and modify keyword redirect configuration using the Search and Navigation REST API. For example, you can create a keyword trigger of "delivery" and a redirect URL of http://shipping.acme.com. Or you might create a keyword redirect with a keyword trigger of "stores" and a redirect URL of http://www.acme.com/store_finder.htm.
Keyword redirects are configured by three
ecr:type
objects:
Note
It is possible to configure more than one
redirect-group
object, but for all ordinary purposes
a single
redirect-group
object is sufficient.
The redirects object is defined by a single attribute, which specifies
its ECR type: "ecr:type": "redirects"
.
Note
You cannot add attributes to or modify attribute values of the
redirects
object; for this reason, you cannot modify
it using the PATCH method.
The following example illustrates the configuration of a
redirects
object containing a
redirect-group
object named Products, which contains
redirect-entry
objects named
id1
and
id2
:
{ "ecr:type": "redirects", "Products" : { "ecr:type": "redirect-group", "id1" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }, "id2" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya", } } }
This section describes how to view, replace, modify, and create keyword redirects, either locally or remotely.
You can export keyword redirect configuration locally in order to view it, modify it, or archive it.
To export configuration of the
redirects
object locally, execute a command of the
following form:
runcommand.bat IFCR exportContent redirects directory
where
directory
identifies the directory to which a
ZIP file containing the configuration is exported. Do not specify a file name
for exported content.
For example, the following JSON sample illustrates the configuration
of a
redirects
object that can be returned by the
exportContent
command shown above:
{ "ecr:lastModifiedBy": "occ_admin", "ecr:lastModified": "2016-10-26T09:32:32.602-07:00", "ecr:createDate": "2016-10-26T09:32:32.602-07:00", "ecr:type":"redirects", "Default": { "ecr:lastModifiedBy": "occ_admin", "ecr:lastModified": "2016-10-26T09:32:32.661-07:00", "ecr:createDate": "2016-10-26T09:32:32.661-07:00", "ecr:type":"redirect-group" } }
Note that this configuration does not include all the attributes of
the redirect-group object
Default
, or any
redirect-entry
objects in
Default
.
To export configuration of a
redirect-group
object locally, execute a command of
the following form:
runcommand.bat IFCR exportContent redirects/redirect_group_name directory
where:
redirect_group_name
is the name of the
redirect-group
object whose configuration is exported,
and
directory
identifies the directory to which a
ZIP file containing the configuration is exported. Do not specify a file name
for exported content.
For example, the following JSON sample illustrates the configuration
of a
redirect-group
object that can be returned by the
exportContent
command shown above:
The IFCR
importContent
command enables you to modify keyword
redirects by importing into the ECR a JSON document stored on your file system.
Imported keyword redirect configuration replaces any existing keyword redirect
configuration.
To import the configuration of a
redirects
object locally, use the following
importContent
command:
runcommand.bat IFCR importContent redirects pathname\[filename.zip]
where:
{ "ecr:type": "redirects" }
Using the above command, you can also import child objects of
redirects
when you import
redirects
. For example, the
importContent
command can import configuration for the
redirects
object, a
redirect-group
object named Products, and two
redirect-entry
objects, named
id1
and
id2
:
{ "ecr:type": "redirects", "Products" : { "ecr:type": "redirect-group", "id1" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }, "id2" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" } } }
To import a
redirect-group
object locally, use the following
importContent
command:
runcommand.bat IFCR importContent redirects/redirect-group pathname\filename.zip
where:
{ "ecr:type": "redirect-group"}
Using the above command, you can also import child objects of the
redirect-group
object when you import
redirect-group
. For example, the JSON file can
configure the
redirect-group
object and two
redirect-entry
objects, named
id1
and
id2
:
{ "ecr:type": "redirect-group", "id1" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }, "id2" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" } }
To import a
redirect-entry
object locally, use the following
importContent
command:
runcommand.bat IFCR importContent redirects/redirect-group-name/redirect-entry-name pathname\filename.zip
where:
The JSON file must be named
_.JSON
, and must contain JSON configuration such as
the following:
{ "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }
This section describes how to export keyword redirect configuration remotely, using the Search and Navigation REST API.
To export the redirects object remotely, execute a GET request of the following form:
GET http://host:port/ifcr/gsadmin/v1/application/redirects
where:
For example, the following GET request exports the redirects object from the Discover application:
GET http://host:port/ifcr/gsadmin/v1/Discover/redirects
For example, the following JSON sample illustrates the configuration
of a
redirects
object that can be returned by the
GET
request shown above:
{ "ecr:lastModifiedBy": "occ_admin", "ecr:lastModified": "2016-10-26T09:32:32.602-07:00", "ecr:createDate": "2016-10-26T09:32:32.602-07:00", "ecr:type":"redirects","Default": { "ecr:lastModifiedBy": "occ_admin", "ecr:lastModified": "2016-10-26T09:32:32.661-07:00", "ecr:createDate": "2016-10-26T09:32:32.661-07:00", "ecr:type":"redirect-group" } }
Note that this configuration does not include all the attributes of
the redirect-group object
Default
, or any
redirect-entry
objects in
Default
.
To export the
redirect-group
object remotely, execute a GET request
of the following form:
GET http://host:port/ifcr/gsadmin/v1/application/redirects/redirect-group-name
where:
redirect-group-name
is the name of the
redirect-group
object whose configuration is exported.
For example, the following GET request exports the
redirect-group
object named Default from the Discover
application:
GET http://host:port/ifcr/gsadmin/v1/Discover/redirects/Default
To export a
redirect-entry
object remotely, execute a GET request
of the following form:
GET http://host:port/ifcr/gsadmin/v1/application/redirects/redirect-group-name /redirect-entry-name
where:
For example, the following GET request exports the
redirect-entry
object named
id1
from the
redirect-group
object named
Default
from the Discover application:
GET http://host:port/ifcr/gsadmin/v1/Discover/redirects/Default/id1
This section describes how to modify keyword redirect configuration using the Search and Navigation REST API.
To import the
redirects
object remotely, execute the following POST
request:
POST http://host:port/ifcr/gsadmin/v1/Discover/redirects
Use the following request body with the POST request above to create
the
redirects
object:
{ "ecr:type": "redirects" }
Using the above command, you can also import the configuration of
child objects of
redirects
with the configuration of
redirects
. For example, the JSON file can configure
the
redirects
object, a
redirect-group
object named Products, and two
redirect-entry
objects, named id1 and id2:
{ "ecr:type": "redirects", "Products" : { "ecr:type": "redirect-group", "id1" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }, "id2" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" } } }
To import the
redirect-groups
object remotely, execute the following
POST request:
POST http://host:port/ifcr/gsadmin/v1/Discover/redirects/redirect-group-name
where:
redirect-group-name is the name of the
redirect-group
object that you are importing. The
imported configuration overwrites any existing configuration of the
redirect-group
object with the specified name.
For example, the following command imports configuration of a redirect-group object named Products:
POST http://host:port/ifcr/gsadmin/v1/Discover/redirects/Products
Provide the following JSON content with the POST request above to
create the
redirect-group
object named Products:
{ "ecr:type": "redirect-group" }
Using the above command, you can also import child objects of
redirects
when you import
redirects
. For example, the JSON file can configure
the
redirects
object, a
redirect-group
object and two
redirect-entry
objects, named
id1
and
id2
:
{ "ecr:type": "redirects", "Products" : { "ecr:type": "redirect-group", "id1" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }, "id2" : { "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" } } }
To import the
redirect-entry
object remotely, execute the following
POST request:
POST http://host:port/ifcr/gsadmin/v1/Discover/redirects/redirect-group-name /redirect-entry-name
where:
redirect-group-name is the name of the
redirect-group
object that you are importing. The
imported configuration overwrites any existing configuration of the
redirect-group
object with the specified name.
redirect-group-entry is the name of the
redirect-entry
object that you are importing. The
imported configuration overwrites any existing configuration of the
redirect-entry
object with the specified name.
For example, the following POST endpoint creates a
redirect-entry
object named
id1
in the
redirect-group
named
Default
:
POST http://host:port/ifcr/gsadmin/v1/Discover/redirects/Default/id1
Provide the following JSON content with the POST request above to
create the
redirect-entry
object named
id1
:
{ "ecr:type": "redirect-entry", "searchTerms": "canon", "matchmode": "MATCHEXACT", "url": "/browse/Canon/_/N-1z141ya" }