Skip to main content

Theme

Version: 1.0

A theme is the look and feel template for your haravan shop.

omni_api_theme

A shop can have multiple themes which take the role of either "published" or "unpublished". Each shop can have 20 themes total, including one main theme, and a max of 19 unpublished themes. The published theme is the one customers see when visiting the shop in a desktop browser. Unpublished themes are themes that customers cannot currently see. When you publish a theme, the previously published theme will become unpublished.

Authenticated access scopes: web.read_themes, web.write_themes

What you can do with Theme?

The haravan API lets you do the following with the Theme resource. More detailed versions of these general actions may be available:

Theme Properties


created_at: string

{ "created_at" : "2012-08-24T14:01:47-04:00" }

The date and time when the theme was created. The API returns this value in ISO 8601 format.

id: number

{ "id" : 828155753 }

TA unique numeric identifier for the theme.

name: string

{ "name" : "Comfort" }

The name of the theme.

role: string

{ "role" : "main" }

Specifies how the theme is being used within the shop. Valid values are:

  • main: the theme customers see when visiting the shop in a desktop browser.
  • mobile: the theme customers see when visiting the shop in a mobile browser.
  • unpublished: the theme that customers cannot currently see.

updated_at: string

{ "updated_at" : "2012-08-24T14:01:47-04:00" }

The date and time when the theme was last updated. The API returns this value in ISO 8601 format.

previewable: boolean

{ "previewable" : true }

Indicates if the theme can currently be previewed.

processing: boolean

{ "processing" : true }

Indicates if files are still being copied into place for this theme.

Endpoints



Receive a list of all Themes

GET
https://apis.haravan.com/web/themes.json

Parameters


fields

comma-separated list of fields to include in the response


Get a list of a shop's themes

  • GET https://apis.haravan.com/web/themes.json
Details
HTTP/1.1 200 OK
{
"themes": [
{
"created_at": "2015-03-28T13:31:19-04:00",
"id": 828155753,
"name": "Comfort",
"role": "main",
"theme_store_id": null,
"updated_at": "2015-03-28T13:33:30-04:00",
"previewable": true,
"processing": false
},
{
"created_at": "2015-03-28T13:31:19-04:00",
"id": 976877075,
"name": "Speed",
"role": "mobile",
"theme_store_id": null,
"updated_at": "2015-03-28T13:33:30-04:00",
"previewable": true,
"processing": false
},
{
"created_at": "2015-03-28T13:31:19-04:00",
"id": 752253240,
"name": "Sandbox",
"role": "unpublished",
"theme_store_id": null,
"updated_at": "2015-03-28T13:31:19-04:00",
"previewable": true,
"processing": false
}
]
}


Receive a single Theme

GET
https://apis.haravan.com/web/themes/{theme_id}.json

Parameters


fields

comma-separated list of fields to include in the response


Get a single theme

  • GET https://apis.haravan.com/web/themes/828155753.json
Details
HTTP/1.1 200 OK
{
"theme": {
"created_at": "2015-03-28T13:31:19-04:00",
"id": 828155753,
"name": "Comfort",
"role": "main",
"theme_store_id": null,
"updated_at": "2015-03-28T13:31:19-04:00",
"previewable": true,
"processing": false
}
}


Create a new Theme

POST
https://apis.haravan.com/web/themes.json

Create a theme by providing the public URL of a .zip containing the theme. The theme always starts out with a role of "unpublished." If a different role is provided in the POST request, the theme will be given that role only after all its files have been extracted and stored by haravan (which might take a couple of minutes).

Create a theme from a URL and give it a custom name and role.

  • POST https://apis.haravan.com/web/themes.json
{
"theme": {
"name": "Lemongrass",
"src": "http:\/\/themes.haravan.com\/theme.zip",
"role": "main"
}
}
Details
HTTP/1.1 201 Created
{
"theme": {
"created_at": "2015-03-28T13:33:29-04:00",
"id": 1049083723,
"name": "Lemongrass",
"role": "unpublished",
"theme_store_id": null,
"updated_at": "2015-03-28T13:33:29-04:00",
"previewable": false,
"processing": false
}
}

Trying to create a theme without a name will return an error

  • POST https://apis.haravan.com/web/themes.json
{
"theme": {
"body": "foobar"
}
}
Details
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
]
}
}


Modify an existing Theme

PUT
https://apis.haravan.com/web/themes/{theme_id}.json

Change the theme's name

  • PUT https://apis.haravan.com/web/themes/752253240.json
{
"theme": {
"id": 752253240,
"name": "Experimental"
}
}
Details
HTTP/1.1 200 OK
{
"theme": {
"created_at": "2015-03-28T13:31:19-04:00",
"id": 752253240,
"name": "Experimental",
"role": "unpublished",
"theme_store_id": null,
"updated_at": "2015-03-28T13:33:30-04:00",
"previewable": true,
"processing": false
}
}

Changing the theme's role to main or mobile will publish the theme to that role

  • PUT https://apis.haravan.com/web/themes/752253240.json
{
"theme": {
"id": 752253240,
"role": "main"
}
}
Details
HTTP/1.1 200 OK
{
"theme": {
"created_at": "2015-03-28T13:31:19-04:00",
"id": 752253240,
"name": "Sandbox",
"role": "main",
"theme_store_id": null,
"updated_at": "2015-03-28T13:33:30-04:00",
"previewable": true,
"processing": false
}
}


Remove a Theme from the database

DELETE
https://apis.haravan.com/web/themes/{theme_id}.json

Remove a theme

  • DELETE https://apis.haravan.com/web/themes/752253240.json
Details
HTTP/1.1 200 OK
{
"created_at": "2015-03-28T13:31:19-04:00",
"id": 752253240,
"name": "Sandbox",
"role": "unpublished",
"theme_store_id": null,
"updated_at": "2015-03-28T13:31:19-04:00",
"previewable": true,
"processing": false
}