Log In  |  Sign Up  |  Help

Sites

A Site instance resource represents a single DudaMobile mobile site.

Resource URIs

Create Site

Call the DudaMobile API to create a new site. This site will be created in the account associated with the API key you are using. The site name you use must be unique on the DudaMobile platform.

POST /sites/create

Parameters:

The JSON structure that should be passed as request body:

Property Type Required Description
site_data Site required parameter of type Site (see below)
publish_now* Boolean optional Whether the created site should be published immediately. Possible values ("true", "false"). Default: "false"
create_now String (true, false, async) optional The create now option allows you to change when the site will be created. By default it will create at the time of your POST ("true"), but you can define "false" to delay creation until the site is accessed or "async" to try and create it now, but without blocking the response.

Site resource properties for site creation (site_data):

Property Type Required Description
site_name string optional If provided must be unique value across all Sites in the system (at least 4 chars, max 45 chars). If not provided the unique name will be generated (and returned) based on original_site_url
original_site_url url required The desktop site URL that DudaMobile will use to base mobile site off of. (max 2048 chars)
preview_site_url url optional The desktop website's preview URL for use during mobile website editing. If null, original_site_url is used. (max 2048 chars)
site_domain url optional The custom domain that will be used on the mobile site. Most people choose ‘m.example.com’, but others can be used (max 253 chars).
auto_sync_cache_ttl String optional Either: VERY_SHORT, SHORT, LONG, VERY_LONG.
This is how long the cache on the mobile site will be stored. This is how frequently DudaMobile will check the desktop site for updates in order to perform auto-sync. The default value is SHORT of 2 Hours.
site_vertical String optional Providing a vertical helps DudaMobile improve the conversion of the site so we can implement layout best practices. Example: Business
site_vertical_category String optional Example: Restaurant
business_site_info Business Site Info Data Structure optional If phone number is provided in create site will populate a ‘click-to-call’ button with the phone number that is passed. If address is provided in create site will populate a ‘mobile map’ button with the address that is passed.
opentable_info OpenTable Data Structure optional If provided, will create an OpenTable button with the information provided. You can pass multiple in order for the button to have multiple locations associated with it.
external_uid string optional A flexible string you pass to DudaMobile when creating the site, allows you to store your customers unique value to reference later (max 45 chars).

An Address data structure is used by multiple Site APIs and is represented by the following properties. Providing an address helps the site creation process by giving DudaMobile more information about the location of the site. For example, if you provide an address we will automatically populate a mobile maps button and potentially find other resources online.

Property Type Description
Street string
City string
State string
Country string
zip_code numeric string

An OpenTable Info data structure is used by multiple Site APIs and is represented by the properties below. Providing this will create an OpenTable button and help DudaMobile find more information about the website online.

Property Type Description
restaurant_id string Ex: 111
location string Ex: Downtown San Francisco
country string Ex: US

A Site Business Info data structure is used by multiple Site APIs and is represented by the properties below. Providing this information during site creation improves the conversion of the mobile site and helps populate site data.

Property Type Description
business_name string
phone_number string
address Address (as defined above)
opentable_info Array of one or more OpenTable Info data structures (as defined above) for each restaurant location. Ex: [ {"restaurant_id":"111", "location":"San Francisco",
"country":"US"} ]

Return:

The following JSON structure :

Property Type Description
site_name string The site name of the create mobile Site.

Errors:

ResourceAlreadyExistInvalidInput

Example:
POST /sites/create
{
  "site_data": {
    "site_name": "de6f096c-10e0-47d4-bcde-c685b401f653",
    "original_site_url": "http://www.abcz.com",
    "site_domain": "http://m.abcz.com",
    "auto_sync_cache_ttl": "VERY_SHORT",
    "site_vertical": "Business",
    "site_vertical_category": "Restaurant",
    "site_business_info":
    {
      "business_name": "Open Market",
      "phone_number": "4157775577",
      "address":
      {
          "country": "US",
          "city": "San Francisco",
          "state": "CA",
          "street": "1 Market Street",
          "zip_code": "94111"
      },
      "opentable_info": [
            { "restaurant_id": "4", "location": "San Francisco", "country": "US" },
            { "restaurant_id": "44", "location": "Chicago", "country": "US" }
      ],
    },
    "external_uid": "AD342"
  },
  "publish_now": "false",
  "create_now": "true"
}

Retrieve Site

Use this call to get information about an existing site. You should already know the site name, as you provided it when originally creating the site.

HTTP GET /sites/{site_name}

Parameters:

site_name - URL parameter - site name

Return:

The following JSON structure representing the Site:

Property Type Description
site_name string The mobile site name. The site name is a unique identifier of the mobile Site.
original_site_url url The desktop website's runtime URL for use during DudaMobile production runtime.
preview_site_url url The desktop website's preview URL for use during mobile website editing. If null, original_site_url is used.
site_domain url The mobile site domain
auto_sync_cache_ttl String Either: VERY_SHORT, SHORT, LONG, VERY_LONG
site_vertical String Example: Business
site_vertical_category String Example: Restaurant
business_site_info Business Site Info Data Structure
external_uid string Optional placeholder to be used to reference/link the created Site to some unique identifier origin from external system
last_published_date date, in UTC: YYYY-MM-DDThh:mm:ss The last time the site was published, if the site is currently published.
last_confirmed_redirected_date date, in UTC: YYYY-MM-DDThh:mm:ss The last occurrence of the mobile site's retrieval as a consequence of the client having been redirected from the original site
status String If site created with "async" option will have UNDER_CONSTRUCTION value until site creation is completed or failed. For properly created site this filed is ommited from response.
creation_status String If site created with "async" option may have either PENDING (in creation) or FAILED_FRAMESET_UNSUPPORTED, FAILED_CONTENT_TOO_BIG, FAILED if site creation has failed. For properly created site this filed is ommited from response.

Errors:

ResourceNotExist

Example:
GET /sites/de6f096c-10e0-47d4-bcde-c685b401f653
{
  "site_name": "de6f096c-10e0-47d4-bcde-c685b401f653",
  "original_site_url": "http://www.abcz.com",
  "site_domain": "http://m.abcz.com",
  "auto_sync_cache_ttl": "VERY_SHORT",
  "site_vertical": "Business",
  "site_vertical_category": "Restaurant",
  "site_business_info":
  {
    "business_name": "Open Market",
    "phone_number": "4157775577",
    "address":
    {
        "country": "US",
        "city": "San Francisco",
        "state": "CA",
        "street": "1 Market Street",
        "zip_code": "94111"
    },
    "opentable_info": [
     { "restaurant_id": "4", "location": "San Francisco", "country": "US" },
     { "restaurant_id": "44", "location": "Chicago", "country": "US" }
    ],
  },
  "external_uid": "AD342",
  "last_published_date": "2012-09-03T07:02:41",
  "last_confirmed_redirected_date": "2012-09-04T02:04:11"
}

Retrieve Site by External ID

This will return information about an existing, much like retrieve site. Instead of supplying a site_name, you will send the external_uid you originally supplied when making the site.

GET /sites/byexternal/{external_uid}

Parameters:

external_uid - Unique identifier used to reference the site

Return:

The following JSON structure representing the Site:

Property Type Description
site_name string The mobile site name. The site name is a unique identifier of the mobile Site.
original_site_url url The desktop website's runtime URL for use during DudaMobile production runtime.
site_domain url The mobile site domain
auto_sync_cache_ttl String Either: VERY_SHORT, SHORT, LONG, VERY_LONG
site_vertical String Example: Business
site_vertical_category String Example: Restaurant
business_site_info Business Site Info Data Structure
external_uid string Optional placeholder to be used to reference/link the created Site to some unique identifier origin from external system
last_published_date date, in UTC: YYYY-MM-DDThh:mm:ss The last time the site was published, if the site is currently published.
last_confirmed_redirected_date date, in UTC: YYYY-MM-DDThh:mm:ss The last occurrence of the mobile site's retrieval as a consequence of the client having been redirected from the original site

Errors:

ResourceNotExist

Example:
GET /sites/byexternal/AD342
{
  "site_name": "de6f096c-10e0-47d4-bcde-c685b401f653",
  "original_site_url": "http://www.abcz.com",
  "site_domain": "http://m.abcz.com",
  "auto_sync_cache_ttl": "VERY_SHORT",
  "site_vertical": "Business",
  "site_vertical_category": "Restaurant",
  "site_business_info":
  {
    "business_name": "Open Market",
    "phone_number": "4157775577",
    "address":
    {
        "country": "US",
        "city": "San Francisco",
        "state": "CA",
        "street": "1 Market Street",
        "zip_code": "94111"
    },
    "opentable_info": [
     { "restaurant_id": "4", "location": "San Francisco", "country": "US" },
     { "restaurant_id": "44", "location": "Chicago", "country": "US" }
    ],
  },
  "external_uid": "AD342",
  "last_published_date": "2012-09-03T07:02:41",
  "last_confirmed_redirected_date": "2012-09-04T02:04:11"
}

Update Site

You can use this call to update prosperities about a site that is already created. The most common use for this would be to update the site_domain of an already created site or to adjust the cache timings.

POST /sites/update/{site_name}

Parameters:

site_name - URL parameter - site name

The JSON structure that should be passed as request body (at least one of the fields should be present):

Property Type Required Description
site_domain fully qualified domain name Optional The mobile site domain name (max 253 chars)
original_site_url url Optional The desktop website's runtime URL for use during DudaMobile production runtime. (max 2048 chars)
auto_sync_cache_ttl String Optional Either: VERY_SHORT, SHORT, LONG, VERY_LONG
external_uid string Optional Placeholder for external system unique identifier. (max 45 chars)

Return:

None

Errors:

ResourceNotExistInvalidInput

Example:
POST /sites/update/de6f096c-10e0-47d4-bcde-c685b401f653 
{ 
  "auto_sync_cache_ttl": "VERY_LONG" 
}

Delete Site

This will immediately and permanently delete the site and cancel any subscription associated with the site. Please note that after deleting a site there is no way to bring the site back.

DELETE /sites/{site_name}

Parameters:

site_name - URL parameter - site name

Return:

None

Errors:

ResourceNotExist

Example:
DELETE /sites/de6f096c-10e0-47d4-bcde-c685b401f653

Recreate Site

This will reset an existing site using the same proprieties that were originally used to create the site. Note: Any edits or changes made to the site will be lost during the recreate.

POST /sites/recreate/{site_name}

Parameters:

site_name - URL parameter - site name

The JSON structure that may optionally be POSTed:

Property Type Required Description
republish true / false Optional Whether or not to republish the site being recreated. Default: false

Return:

None

Errors:

ResourceNotExist

Example:
POST /sites/recreate/de6f096c-10e0-47d4-bcde-c685b401f653

Publish Site

Takes the development version of the site and copies it to production. Publishing a site for the first time will also charge your account and create a new subscription unless you have included the test parameter. You can publish a site at any time, which will overwrite the production version of the site with the development version.

POST /sites/publish/{site_name}

Parameters:

site_name - URL parameter - site name

Return:

None

Errors:

ResourceNotExist

Example:
POST /sites/publish/de6f096c-10e0-47d4-bcde-c685b401f653

Unpublish Site

Removes the mobile site from the production environment. This is good for disabling the mobile site or taking it down temporarily so no one can access it. Unpublishing a site does not cancel or pause the subscription.

POST /sites/unpublish/{site_name}

Parameters:

site_name - URL parameter - site name

Return:

None

Errors:

ResourceNotExist

Example:
POST /sites/unpublish/de6f096c-10e0-47d4-bcde-c685b401f653

Reset Runtime Cache

This will reset the cache for a site on the production environment. Doing so allows the site to auto-sync the latest content from the desktop site, instead of waiting for the cache timer to expire.

POST /sites/resetcache/{site_name}

Parameters:

site_name - URL parameter - site name

Return:

None

Errors:

ResourceNotExist

Example:
POST /sites/resetcache/de6f096c-10e0-47d4-bcde-c685b401f653

Retrieve Sites created during given period

Will return an array of site names created during the given time period. If no from parameter is specified, sites created in the past 7 days will be returned.

GET /sites/created

Query String Parameters:

Query String Parameter Type Required Description
from Date optional, defaults to 7 days prior to "to" value Start Date Used for Lookup (In UTC: YYYY-MM-DDThh:mm:ss OR YYYY-MM-DD)
to Date optional, defaults to current date End Date Used for Lookup (In UTC: YYYY-MM-DDThh:mm:ss OR YYYY-MM-DD)

Return:

Array containing the following JSON structure representing the Sites:

Property Type Description
site_name string The mobile site name. The site name is a unique identifier of the mobile Site.

Errors:

InvalidInput

Example:
GET /sites/created?from=2012-09-04&to=2012-09-05

Retrieve Sites modified during given period

 

GET /sites/modified

Will return an array of site names modified during the given time period. If no from parameter is specified, sites modified in the past 7 days will be returned.

Query String Parameters:

Query String Parameter Type Required Description
from Date optional, defaults to 7 days prior to "to" value Start Date Used for Lookup (In UTC: YYYY-MM-DDThh:mm:ss OR YYYY-MM-DD)
to Date optional, defaults to current date End Date Used for Lookup (In UTC: YYYY-MM-DDThh:mm:ss OR YYYY-MM-DD)

Return:

Array containing the following JSON structure representing the Sites:

Property Type Description
site_name string The mobile site name. The site name is a unique identifier of the mobile Site.

Errors:

InvalidInput

Example:
GET /sites/modified?from=2012-09-04&to=2012-09-05

Retrieve Multiple Sites

By sending an array of site names you can retrieve information about multiple sites at once. This is much quicker than calling the retrieve site multiple times. A maximum of 50 sites can be retrieved at once.

POST /sites/get-many

Parameters:

An Array should be posted included one or more items of the following JSON structure, identifying the sites requested (maximum of 50):

Property Type Required Description
site_name string required the site_name of a site requested

Return:

The following JSON structure representing the Sites:

Property Type Description
site_name string The mobile site name. The site name is a unique identifier of the mobile Site.
original_site_url url The desktop website's runtime URL for use during DudaMobile production runtime.
site_domain url The mobile site domain
auto_sync_cache_ttl String Either: VERY_SHORT, SHORT, LONG, VERY_LONG
site_vertical String Example: Business
site_vertical_category String Example: Restaurant
business_site_info Business Site Info Data Structure
external_uid string Optional placeholder to be used to reference/link the created Site to some unique identifier origin from external system
last_published_date date, in UTC: YYYY-MM-DDThh:mm:ss The last time the site was published, if the site is currently published.
last_confirmed_redirected_date date, in UTC: YYYY-MM-DDThh:mm:ss The last occurrence of the mobile site's retrieval as a consequence of the client having been redirected from the original site

Errors:

ResourceNotExist

Example:
POST /sites/get-many
[
{"site_name":"de6f096c-10e0-47d4-bcde-c685b401f653"},
{"site_name":"92ad71a8-7b29-4f1c-a487-ec57ac2807c1"},
{"site_name":"081ea718-4fcb-485b-a909-760ac7a48c89"}
]