Sites are made up of pages that can be rearranged as needed. Each page has a title and a layout. Site owners can hide pages.

The Pages API provides methods for reading and updating information about the pages for a site.

Fields

The following table shows all fields that exist for this API, those that are returned when you retrieve a list and those that are changeable using PATCH. All fields are returned when you retrieve a single item.

Name Description Type List Changeable
page_id The unique ID of a page string X
title The title of a given page ​ string X X
page_order Where this page appears in its navigation menu, as configured on the Pages tab of the editor. For example: ​
Home - page_order 1
    HomeSubPage - page_order 1
    HomeSubPage - page_order 2
About - page_order 2
    AboutSubPage - page_order 1
Contact - page_order 3
    ContactSubPage - page_order 1
        
You can determine the hierarchy using the parent_id for the page.
integer X
hidden Whether or not the page is hidden from the site's navigation.
Valid values are:
  • true
  • false
boolean
membership_required Whether or not the page requires site membership in order to be viewed.
Valid values are:
  • true
  • false
boolean
parent_id The page_id of the page one level up in the navigation hierarchy. If there is no parent, null is returned. string X
layout The layout header used for the page.
Valid values are:
  • short-header
  • tall-header
  • no-header
string X
page_url Relative URL for the page. You can get the domain from GET /user/sites/SITEID string X
updated_date Date the page was last updated. Unix GMT Timestamp X

GET
Retrieve a List of Pages

GET /v1/user/sites/{SITE_ID}/pages

Returns all pages for the given site. Only list fields are returned.


scope: read:site

Query Parameters

Returned values are paginated. You can further filter results using these parameters:

Parameter Description Type
page Which page of results to return. Start is 1. integer
limit Number of results per page to return. Default is 25.
Max is 200.
integer
query Use to retrieve only pages that have a full-text match with the query string. string
filterby Field name to set a filter on. Valid values are:
  • page_id
  • title
  • layout
string
filterfor ​Value to search the filterby field for. string
sortby Field name to sort by string
sortdir Sort direction. Valid values are:
  • asc
  • desc
string

Example CURL request returning all pages:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/pages \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example filtered request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/pages?filterby=layout&filterfor=tall-header \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "page_id": "131221993403487092",
        "title": "new",
        "page_order": 2,
        "parent_id": "205694454183612584",
        "layout": "tall-header",
        "page_url": "new.html"
    },
    {
        "page_id": "205694454183612584",
        "title": "Blog",
        "page_order": 2,
        "parent_id": null,
        "layout": "tall-header",
        "page_url": "blog1.html"
    },
    {
        "page_id": "267240304658043510",
        "title": "members only",
        "page_order": 4,
        "parent_id": null,
        "layout": "tall-header",
        "page_url": "members-only.html"
    }
]

GET
Retrieve Details for a Page

GET /v1/user/sites/{SITE_ID}/pages/{PAGE_ID}

Returns all fields for the given page.


scope: read:site

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/pages/131221993403487092 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the page are returned.

{
    "page_id": "131221993403487092",
    "title": "new",
    "hidden": false,
    "membership_required": null,
    "parent_id": "205694454183612584",
    "layout": "tall-header",
    "updated_date": "2014-11-06 15:57:56",
    "page_url": "new.html"
}

PATCH
Update a Page

PATCH /v1/user/sites/{SITE_ID}/pages/{PAGE_ID}

Updates the given page.


scope: write:site

These fields can be updated:

Name Description Type Notes
title The page's title. string Required

Example CURL request:

curl --request PATCH \
--url https://api.weebly.com/v1/user/sites/987654321/pages/1234567890 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"
--data '{
            "title": "New Title"
        }'

Example response:

See Fields table. All fields for the page are returned.

{
    "page_id": "1234567890",
    "title": "New Title",
    "hidden": false,
    "membership_required": null,
    "parent_id": null,
    "layout": "short-header",
    "updated_date": "2016-02-08 11:16:19",
    "page_url": "new.html"
}

Help make these docs better!









Tags: