WAVE Stand-alone API Documentation
- Apache or Nginx web server
This video shows the process for a basic installation.
- Unzip all package files to a directory on your web server. The htdocs/request.php file must be publicly accessible. If necessary, set up an Apache or Nginx site or virtual directory to point to the directory that contains request.php.
- Set permissions to give the web server write permissions on the the following:
- The /temp/ directory (and, if necessary, the 2 sub-folders). The downloaded web pages and processed results, as well as screen shots (if configured), will be temporarily stored in these folders.
- The /core/api.config.json file. This file stores license information and must not be edited.
- Configure PhantomJS
- PhantomJS is a headless Webkit used to render the pages before evaluation. Versions of PhantomJS are included in the /core/ folder for Windows, Mac, Linux 64-bit, and Linux 32-bit. The files for operating systems you do not need can be deleted, if you choose.
- Set execute permissions for the web server user on the appropriate phantomjs file.
- Open user.config.json and set the following:
- platform: The operating system in use.
- Possible values must be “Windows.exe” (remember the .exe), “Mac”, “Linux32” (for 32-bit Linux), or “Linux64” (for 64-bit Linux)
- core_path: Full path of the directory containing the core files (Core.php, etc.).
- Always end with a training slash. If on Windows, the path might be something like “D:/website/core/” (use / not \ for slashes).
- temp_path: Full path of the /temp/ folder (ending with a training slash) on your server.
- If on Windows, the path might be something like “D:/website/temp/” (use / not \ for slashes).
- screenshot: true or false.
- If set to true, a screenshot will be written to the temp/screenshots/ directory for each page evaluated. Screenshot are in PNG format and may be up to megabytes in size. The file name is a random string that, if enabled, will be returned as a “screenshotid” parameter with the API results. These screenshot files will accumulate very quickly, so be careful. Also, if enabled, all page images will be downloaded (by default, images are not downloaded because they are not necessary for page evaluation). Enabling screenshots may notably increase the download time and increase processor and bandwidth requirements. This parameter can be set on each request by appending the screenshot GET parameter (e.g., &screenshot=true or &screenshot=false).
- evaldelay: 250
- The number of milliseconds to wait after the last page request before evaluating the page. For very dynamic pages or pages that use XHR/AJAX to load page content after the initial page is rendered, it's necessary to ensure that the page is fully rendered before WAVE analysis occurs. This is difficult to determine programatically. By default, the API will wait 250 milliseconds after the page has loaded AND after the last request/receive has completed before beginning its analysis. This value can be modified in the config or the evaldelay GET parameter (e.g., &evaldelay=1000) to either increase it for very dynamic pages or pages loading dynamic content from slow sources, or to decrease it for static pages.
- viewportwidth: 1200
- The number indicates the pixel width at which the page will be evaluated. This can be handy for testing CSS styles applied at different breakpoints for responsive designs. It also defines the width for screenshots, if enabled above. The default is 1200. Refrain from extremely high values as it may impact speed. This parameter can be set on each request by appending the viewportwidth GET parameter (e.g., &viewportwidth=800).
- debug: true or false.
- If set to true, debug information will be written to the screen (this may not be properly formed JSON) and internal processing results (/temp/results/) will NOT automatically be removed. This can be handy for debugging evaluation failures or server and API configuration errors. This parameter can be set on each request by appending the debug=true GET parameter.
- domains: [domainslist].
- The value is a list of domains available for analysis as defined by your WAVE license agreement. The structure is in JSON format. For example, domains: ["webaim.org","w3.org"] - would allow processing of only these two domains. Even if your license allows unlimited domain analysis, you may choose to define these values to ensure proper usage of your API installation.
- platform: The operating system in use.
- Test the API
- Simply go to http://YOURSITE.COM/request.php?key=YOURKEY&url=YOURURL (modify the path as needed to access your request.php file)
- The WAVE Documentation API may be freely accessed via the public WAVE website (e.g., http://wave.webaim.org/api/docs?id=alt) as documented at http://wave.webaim.org/api/details#documentation. A future release will include all files/data for accessing this information locally.
API Query and Output Parameters
MAMP Installation Notes
If installing on MAMP on a Mac, the following modifications may be necessary if an error is returned by the API. Open the /Applications/MAMP/Library/bin/envvars file and comment out the first DYLD_LIBRARY_PATH line and the export line as follows:
if test "x$DYLD_LIBRARY_PATH" != "x" ; then