Documentation

Documentation to build on the Passmarked platform

Create

Passmarked runs tests on websites, which can be either single pages or full websites. The API can be used to start and wait for reports to run and return with the results.

Passmarked runs tests on websites, either single pages or full websites. The API can be used to start and wait for reports to run and return with the results. The results that are returned contain information such:

Weighted score of page, based on the Passmarked community. Both in votes and detected importance
The complete library of tests with their results on what problems were found
screenshots are returned from the page (or entry page for recursive reports) in both desktop and mobile.
palette of the page given
location of servers where the website is being served from
ip of the server that served the page(s)
Complete list of detected technologies on the page (stack) of more than 700 known tech stacks
size of the page
Amount of requests to load the page
loadtime of page

Install

To enable the Passmarked client side API in your project, add the following script:

<script src="//jsapi.passmarked.com/v1.js"></script>

For more details, see github.com/passmarked/js on the project itself.

After adding the script, the passmarked object will become available for use

Creating a token

When generating token, options are given to decide the scope of the token. There are 2 scopes that can be selected, depending on which of the token will have specific permissions:

fullRepresenting the full user, these tokens can see the user's profile, balance and running reports using the credits of the owning user
limitThe token can only create report runs using the credits of the owning user, and not view any other details

To access the user's balance (as detailed here), the token must be full, which will allow access.

Request

To create the report, the .create() function is provided. The function is called as such:

var report = passmarked.create({
  token:  '(token-here)',
  url:    'http://example.com'
});
report.on('done', function(report) {
  console.log('Report scored: ' + report.getScore())
});
report.start(function(err, report) {
  if(err) {
    console.error(err);
  } else if(report.getStatus() == 'done') {
    // the report has already been run in the last hour,
    // ONLY IF ENABLED ON TOKEN, ELSE A NEW PAGE IS RUN EVERYTIME
    console.log('Report UID: ' + results.getUID());
    console.log('Report Score: ' + results.getScore());
  } else {
    console.log('Just started report #' + results.getUID());
  }
});

The function supports and expects a few parameters as such:

NameTypeDescription
tokenstringREQUIRED - The token that will be used to authenticate with the API
urlstringREQUIRED - The url to test or start the recursive report from. Must start with either http:// or https://
recursivebooleanOPTIONAL - Determines if an entire website should be crawled and checked. Defaults to false, meaning a single page report.
limitintegerOPTIONAL - Limits the amount of pages to check. If not provided, the default is 50. Alternatively, if <=0, the limit is marked as unlimited and will only stop once the account runs out of credits or the website is done crawling.
patternsintegerOPTIONAL - Comma delimited list of url patterns in the format: /users/* which will limit the recursive report to only those urls.
testsstringOPTIONAL - Comma delimited list of tests to run. See Library for the list of all available tests. By default all tests are run.
bailbooleanOPTIONAL - Tells the recursive report to stop when an issue with the specified level is found.
levelstringOPTIONAL - Determines the level of issue for when to stop the report for the bail property.

Response

The function will return a Response object that has the following functions. Which is detailed over at View Report.

Signup icon
Ready to see how well your site scores?

Passmarked works best when you have an account. It allows you to keep a dashboard with saved data of the sites you have run through the system, we’ll alert you about important updates and you get access to the Passmarked Slack forum.

Sign up to get started