Shopify API – Redirect

top

Receive a list of all Redirects

Get a list of all URL redirects for your shop.

Available URL Query parameters:

  • limit — Amount of results (default: 50) (maximum: 250)
  • page — Page to show (default: 1)
  • path — Show Redirects with given path
  • target — Show Redirects with given target
GET /admin/redirects.xml

A redirect's "path" attribute is the path which activates this redirect when visited, and a shop cannot have more than one redirect with the same path. The "target" attribute is the URL which the visitor is redirected to when they try to access the associated path. The target could either be a path or a full URL, possibly even for a different domain.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<redirects type="array">
  <redirect>
    <id type="integer">950115853</id>
    <path>/ibook</path>
    <shop-id type="integer">690933841</shop-id>
    <target>/products/macbook</target>
  </redirect>
  <redirect>
    <id type="integer">1742551077</id>
    <path>/leopard</path>
    <shop-id type="integer">690933841</shop-id>
    <target>/pages/macosx</target>
  </redirect>
</redirects>
top

Receive a count of all Redirects

Get a count of all URL redirects for your shop.

Available URL Query parameters:

  • path — Count Redirects with given path
  • target — Count Redirects with given target
GET /admin/redirects/count.xml

A redirect’s “path” attribute is the path which activates this redirect when visited, and a shop cannot have more than one redirect with the same path. The “target” attribute is the URL which the visitor is redirected to when they try to access the associated path. The target could either be a path or a full URL, possibly even for a different domain.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<count type="integer">2</count>
top

Receive a single Redirect

Get a single redirect.

GET /admin/redirects/#{id}.xml

Get a single redirect by its ID.

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">1742551077</id>
  <path>/leopard</path>
  <shop-id type="integer">690933841</shop-id>
  <target>/pages/macosx</target>
</redirect>
top

Create a new Redirect

Create a new redirect.

POST /admin/redirects.xml

We expect users might try going to /ipod in order to find about one of our popular products, but we want to redirect them to /itunes because that's where we have the information they're looking for.

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <path>/ipod</path>
  <target>/pages/itunes</target>
</redirect>      

Response

           
HTTP/1.1 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">1742551086</id>
  <path>/ipod</path>
  <shop-id type="integer">690933841</shop-id>
  <target>/pages/itunes</target>
</redirect>
POST /admin/redirects.xml

We have a separate forums site that is on a different subdomain. The "path" is always converted to an absolute path without a domain, but the "target" can be a full URL.

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <path>http://www.apple.com/forums</path>
  <target>http://forums.apple.com</target>
</redirect>      

Response

           
HTTP/1.1 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">1742551087</id>
  <path>/forums</path>
  <shop-id type="integer">690933841</shop-id>
  <target>http://forums.apple.com</target>
</redirect>
top

Modify an existing Redirect

Update a redirect's path and/or target URIs.

PUT /admin/redirects/#{id}.xml

Change a redirect so that it activates for a different request path:

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">1742551077</id>
  <path>/tiger</path>
</redirect>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">1742551077</id>
  <path>/tiger</path>
  <shop-id type="integer">690933841</shop-id>
  <target>/pages/macosx</target>
</redirect>
PUT /admin/redirects/#{id}.xml

Change both the path and target URIs for an exisiting redirect

Request

           
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">950115853</id>
  <path>/powermac</path>
  <target>/pages/macpro</target>
</redirect>      

Response

           
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<redirect>
  <id type="integer">950115853</id>
  <path>/powermac</path>
  <shop-id type="integer">690933841</shop-id>
  <target>/pages/macpro</target>
</redirect>
top

Remove a Redirect from the database

Delete a redirect

DELETE /admin/redirects/#{id}.xml

Remove an exisiting redirect from a shop

Response

           
HTTP/1.1 200 OK
Last updated at Oct 2009 Oct:10 AM.