Cursion DocsCursion Docs
Home
Dashboard
Home
Dashboard
  • Guides

    • Account
    • Billing
    • Selfhost
    • App
    • API
    • CLI
  • API

    • Site
    • Page
    • Scan
    • Test
    • Case
    • CaseRun
    • Flow
    • FlowRun
    • Issue
    • Schedule
    • Alert
    • Report
  • CLI

    • Site
    • Page
    • Scan
    • Test
    • Case
    • Flow

Page

A Page is the secondary object in the Cursion application and is the child of a Site. A Page represent the single webpage the url points to (i.e. example.com points to example.com and example.com/blog points to example.com/blog).

Page object

{
   "id":"46053956-761b-4ca5-8cec-3be796695d12",    // uuid specific to the Page
   "user":"example@gmail.com",                     // user denoted by email
   "site": "46052956-762b-42a5-8c2c-3be792695d12", // parent Site uuid                  
   "page_url":"https://example.com",               // Page's url begining with https:// or http://
   "time_created":"2021-11-18T15:58:42.821177Z",   // timestamp of object creation
   "tags": ["tag1", "tag2"],                       // <optional> list of info for user to track data
   "info":{ 
      "status":{
         "badge":"success",   // info for front-end badge coloring
         "score": 69.25,      // health score, combination of yellowlab and lighthouse. Type -> float
         "health":"Good"      // health status (Good, Okay, Poor)
      },
      "yellowlab":{           // high level Yellow Lab scores
         "fonts": 100,
         "badCSS": 95,
         "jQuery": 100,
         "images": 100,
         "pageWeight": 94,
         "globalScore": 67,
         "serverConfig": 100,
         "badJavascript": -5,
         "cssComplexity": 99,
         "domComplexity": 100,
         "javascriptComplexity": -28
      },
      "lighthouse":{          // high level Lighthouse scores
         "seo": 85,    
         "average": 78.25,  
         "performance": 60,  
         "accessibility": 75,   
         "best_practices": 93,   
         "pwa": 89,
         "crux": 90
      },
      
      "latest_scan":{
         "id":"fdbfea8a-d049-45df-8085-2be020e3e193",          // most recent Scan uuid
         "time_created":"2021-11-19 19:35:54.297510+00:00",    // timestamp of most recent Scan creation
         "time_completed":"2021-11-19 19:38:58.345660+00:00",  // timestamp of most recent Scan completion
      },
      "latest_test":{
         "id":"eff40980-a9c2-45d6-8929-99564715a216",          // most recent Test uuid
         "score": 97,                                          // most recent Test score (out of 100)
         "time_created":"2021-11-19 19:35:28.315063+00:00",    // timestamp of most recent Test creation
         "time_completed":"2021-11-19 19:38:58.345660+00:00",  // timestamp of most recent Test completion
      }
   }
}

Create a Page

This endpoint allows the creation task to run asynchronously on the server and resolves quickly. The full on boarding of a page may take several minutes to complete as the server is actively creating initial base-line Scans for each.

data in this request:

"data": {
   
   "page_url": "https://example.com/blog",               // <required> 
   "site_id": "fdbfew8a-d049-45df-8f85-2be020e4e193",    // <required> parent Site uuid
   "page_urls": [                                        // <optional> array of pages to add (should replace "page_url" when used)
      "https://example.com/blog", 
      "https://example.com/blog",
   ],    
   "tags": ["tag1", "tag2"],                             // <optional> for user to track data
   "no_scan": false,                                     // <optional> bool parameter which, when true, will skip the initial Scan creation (defaults to false)
   
   "configs": {                           // <optional> Configurations for webdriver (only needed if no_scan == False)
      "browser":"chrome",                 // browser to be used for the tasks, either chrome or firefox
      "device": "desktop",                // sets the user-Agent, one of dekstop or mobile
      "mask_ids": null,                   // element id's you wish to mask when taking a screenshot (seperated by comma)
      "interval": 5,                      // time (seconds) the driver will wait between checking if page has loaded
      "window_size": "1920,1080",         // dimensions of webdriver window. format -> (width,height)
      "max_wait_time": 60,                // maximum time (seconds) the driver will wait before moving on to next task
      "min_wait_time": 10,                // minimum time (seconds) the driver will wait before checking if page has loaded and or moving on to next task
      "disable_animations": false,        // bool which, when true, will disable all animations and videos on the site during a Scan
      "auto_height": true,                // bool which, when true, will automatically resize the browser window to the full lenghth of a Page
      "timeout": 300                      // maximum time (seconds) the driver will run before completely timing out during an the VRT process
   }

}

Warning

Passing the configs object is optional. However, if you do pass the object you must specify all sub-components.

POST - /page

# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')

# setup configs
url = f'{CURSION_API_BASE_URL}/page'
headers = {
   "content-type": "application/json",
   "Authorization" : CURSION_API_TOKEN
}
data = {
   "page_url": "https://example.com/blog",               
   "site_id": "fdbfew8a-d049-45df-8f85-2be020e4e193",  
   "tags": ["tag1", "tag2"]        
   "no_scan": False,              
   "configs": {                    
      "browser": "chrome",
      "device": "desktop",
      "mask_ids": None,
      "interval": 5,
      "window_size": "1920,1080",
      "max_wait_time": 60,
      "min_wait_time": 10
      "disable_animations": False,
      "auto_height": True,
      "timeout": 300
   }
}

# send the request
res = requests.post(
   url=url, 
   headers=headers, 
   data=json.dumps(data)
)

# retrieve response data
json_response = res.json()
print(json_response)

View Full Output

Output

{
   "id":"188b882a-f644-4304-b2b9-def9d8c76b57",
   "user":"example@gmail.com",
   "site":"146052956-762b-42a5-8c2c-3be792695d12",
   "page_url":"https://example.com",
   "time_created":"2021-11-22T14:54:19.134671Z",
   "tags": ["tag1", "tag2"],
   "info":{
      "latest_scan":{
            "id": null,
            "time_created": null,
            "time_completed": null,
         },
      "latest_test":{
            "id": null,
            "time_created": null,
            "score": null
      },
      "yellowlab":{
         "fonts": null,
         "badCSS": null,
         "jQuery": null,
         "images": null,
         "pageWeight": null,
         "globalScore": null,
         "serverConfig": null,
         "badJavascript": null,
         "cssComplexity": null,
         "domComplexity": null,
         "javascriptComplexity": null
         },
         "lighthouse":{   
            "seo": null,    
            "average": null,  
            "performance": null,  
            "accessibility": null,   
            "best_practices": null,
            "pwa": null,
            "crux": null    
         },
         "status":{
            "score": null,
            "health": null,
            "badge": "neutral"
         }
   }
}

Retrieve a Page

This endpoint returns a single Page object and is useful as a simple "detailed view" of the page.

GET - /page/<page:id>

import requests, os

# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')

# setup configs
url = f'{BASE_URL}/page/<page:id>'
headers = {
    "content-type": "application/json",
    "Authorization" : CURSION_API_TOKEN
}

# send the request
res = requests.get(
    url=url, 
    headers=headers, 
)

# retrieve response data
json_response = res.json()
print(json_response)

View Full Output
{
   "id":"46053956-761b-4ca5-8cec-3be796695d12",
   "user":"example@gmail.com",
   "page_url":"https://example.com/",
   "site":"146052956-762b-42a5-8c2c-3be792695d12",
   "time_created":"2021-11-18T15:58:42.821177Z",
   "tags": ["tag1", "tag2"],
   "info":{
      "status":{
         "badge":"success",
         "health":"Good",
         "score": 80,
      },
      "yellowlab":{ 
         "fonts": 100,
         "badCSS": 95,
         "jQuery": 100,
         "images": 100,
         "pageWeight": 94,
         "globalScore": 67,
         "serverConfig": 100,
         "badJavascript": -5,
         "cssComplexity": 99,
         "domComplexity": 100,
         "javascriptComplexity": -28
      },
      "lighthouse":{
         "seo": 85,
         "average": 78.25,
         "performance": 60,
         "accessibility": 75,
         "best_practices": 93,
         "pwa": 89,
         "crux": 90,
      },
      "latest_scan":{
         "id":"fdbfea8a-d049-45df-8085-2be020e3e193",
         "time_created":"2021-11-19 19:35:54.297510+00:00",
         "time_completed":"2021-11-19 19:38:58.345660+00:00",
      },
      "latest_test":{
         "id":"eff40980-a9c2-45d6-8929-99564715a216",
         "score": 97,
         "time_created":"2021-11-19 19:35:28.315063+00:00",
         "time_completed":"2021-11-19 19:38:58.345660+00:00",
      }
   }
}

Retrieve many Pages

This endpoint returns a paginated response with all Page objects filtered by the passed site_id and ordered by time_created. This endpoint is useful when needing to displaying your pages in a table view for example. The limit parameter specifies the total number of objects you want returned per "group" (we recommend keeping this under 10 for best performance). The offset parameter specfies which "group" to return. For example, limit=10&offset=10 in a total dataset of 30 objects would return 10 pages in range page #10 - page #20.

GET - /page?site_id=<site:id>&limit=10&offset=0

import requests, os

# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')

# setup configs
url = f'{BASE_URL}/page?site_id=<site:id>&limit=10&offset=0'
headers = {
    "content-type": "application/json",
    "Authorization" : CURSION_API_TOKEN
}

# send the request
res = requests.get(
    url=url, 
    headers=headers, 
)

# retrieve response data
json_response = res.json()
print(json_response)

View Full Output
{
   "count":30,
   "next":"https://api.cursion.dev/v1/ops/page?site_id=<site:id>limit=10&offset=20",
   "previous":"https://api.cursion.dev/v1/ops/page?site_id=<site:id>limit=10&offset=10",
   "results":[
      {
         "id":"46053956-761b-4ca5-8cec-3be796695d12",
         "user":"example@gmail.com",
         "page_url":"https://example.com",
         "site":"146052956-762b-42a5-8c2c-3be792695d12",
         "time_created":"2021-11-18T15:58:42.821177Z",
         "tags": ["tag1", "tag2"],
         "info":{
            "status":{
               "badge":"success",
               "health":"Good",
               "score": 80,
            },
            "yellowlab":{ 
               "fonts": 100,
               "badCSS": 95,
               "jQuery": 100,
               "images": 100,
               "pageWeight": 94,
               "globalScore": 67,
               "serverConfig": 100,
               "badJavascript": -5,
               "cssComplexity": 99,
               "domComplexity": 100,
               "javascriptComplexity": -28
            },
            "lighthouse":{
               "seo": 85,
               "average": 78.25,
               "performance": 60,
               "accessibility": 75,
               "best_practices": 93,
               "pwa": 89,
               "crux": 90,
            },
            "latest_scan":{
               "id":"fdbfea8a-d049-45df-8085-2be020e3e193",
               "time_created":"2021-11-19 19:35:54.297510+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            },
            "latest_test":{
               "id":"eff40980-a9c2-45d6-8929-99564715a216",
               "score": 97,
               "time_created":"2021-11-19 19:35:28.315063+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            }
         }
      },
      {
         "id":"46053956-761b-4ca5-8cec-3be796695d12",
         "user":"example@gmail.com",
         "page_url":"https://example.com/blog",
         "site":"146052956-762b-42a5-8c2c-3be792695d12",
         "time_created":"2021-11-18T15:58:42.821177Z",
         "tags": ["tag1", "tag2"],
         "info":{
            "status":{
               "badge":"success",
               "health":"Good",
               "score": 80,
            },
            "yellowlab":{ 
               "fonts": 100,
               "badCSS": 95,
               "jQuery": 100,
               "images": 100,
               "pageWeight": 94,
               "globalScore": 67,
               "serverConfig": 100,
               "badJavascript": -5,
               "cssComplexity": 99,
               "domComplexity": 100,
               "javascriptComplexity": -28
            },
            "lighthouse":{
               "seo": 85,
               "average": 78.25,
               "performance": 60,
               "accessibility": 75,
               "best_practices": 93
               "pwa": 89,
               "crux": 90
            },
            "latest_scan":{
               "id":"fdbfea8a-d049-45df-8085-2be020e3e193",
               "time_created":"2021-11-19 19:35:54.297510+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            },
            "latest_test":{
               "id":"eff40980-a9c2-45d6-8929-99564715a216",
               "score": 97,
               "time_created":"2021-11-19 19:35:28.315063+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            }
         }
      },
      {
         "id":"46053956-761b-4ca5-8cec-3be796695d12",
         "user":"example@gmail.com",
         "page_url":"https://example.com/terms",
         "site":"146052956-762b-42a5-8c2c-3be792695d12",
         "time_created":"2021-11-18T15:58:42.821177Z",
         "tags": ["tag1", "tag2"],
         "info":{
            "status":{
               "badge":"success",
               "health":"Good",
               "score": 80,
            },
            "yellowlab":{ 
               "fonts": 100,
               "badCSS": 95,
               "jQuery": 100,
               "images": 100,
               "pageWeight": 94,
               "globalScore": 67,
               "serverConfig": 100,
               "badJavascript": -5,
               "cssComplexity": 99,
               "domComplexity": 100,
               "javascriptComplexity": -28
            },
            "lighthouse":{
               "seo": 85,
               "average": 78.25,
               "performance": 60,
               "accessibility": 75,
               "best_practices": 93,
               "pwa": 89,
               "crux": 90
            },
            "latest_scan":{
               "id":"fdbfea8a-d049-45df-8085-2be020e3e193",
               "time_created":"2021-11-19 19:35:54.297510+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            },
            "latest_test":{
               "id":"eff40980-a9c2-45d6-8929-99564715a216",
               "score": 97,
               "time_created":"2021-11-19 19:35:28.315063+00:00",
               "time_completed":"2021-11-19 19:38:58.345660+00:00",
            }
         }
      },
      ### SHORTENED FOR DISPLAY PURPOSES ###
   ]
}

Delete a Page

Because Pages are secondary objects within the Cursion API, once a Page is deleted a cascade effect ensues and all assocaited Scans , Tests, Schedules, and Alerts are subsequently deleted.

Caution

Please use caution with this endpoint as it is irreversible.

DELETE - /page/<site:id>

import requests, os

# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')

# setup configs
url = f'{BASE_URL}/page/<page:id>'
headers = {
    "content-type": "application/json",
    "Authorization" : CURSION_API_TOKEN
}

# send the request
res = requests.delete(
   url=url, 
   headers=headers, 
)

# retrieve response data
json_response = res.json()
print(json_response)

View Full Output
{
   "message": "page deleted successfully"
}

Delete many Pages

This endpoint allows the user to send an array of Page id's to be deleted. Cursion will iterate through the id's and respond with an object detailing which Pages were successfully deleted and which were not.

Caution

Please use caution with this endpoint as it is irreversible.

POST - /pages/delete

import requests, os

# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')

# setup configs
url = f'{BASE_URL}/pages/delete'
headers = {
   "content-type": "application/json",
   "Authorization" : CURSION_API_TOKEN
}

data = { 
   "ids": [          # array of Page ids (datatype of string) to be deleted
      '<page:id1>', 
      '<page:id2>', 
      '<page:id3>'
   ] 
}

# send the request
res = requests.post(
    url=url, 
    headers=headers, 
    data=data,
)

# retrieve response data
json_response = res.json()
print(json_response)

View Full Output
{
   "status": true,
   "num_succeeded": 3,
   "succeeded": [
      '<page:id1>', 
      '<page:id2>', 
      '<page:id3>'
   ],
   "num_failed": 0,
   "failed": []
}

Last Updated:
Contributors: Landon, landon
Prev
Site
Next
Scan