Skip to content
Scott Behrens edited this page Aug 9, 2017 · 4 revisions

Capture Model

The following attributes are included in the Capture model:

NOTE: url, status_only, and callback are provided in the POST request to the Sketchy API.

  • url
  • status_only
  • callback
  • job_status
  • capture_status
  • created_at
  • modified_at
  • retry
  • sketch_url
  • scrape_url
  • html_url

url

string

required

The url is provided by the consumer in the form of a JSON post request. The url is required to submit a task in the Celery queue. The url will be visited first to confirm it is valid. Next, Sketchy will generate a capture that includes a screenshot, text scrape, and html file. If the status_only flag is sent on the JSON post request, the task will only confirm the url is valid and then the task is completed.

status_only

boolean

optional

The status_only boolean is provided by the consumer in the form of a JSON post request. If set to true, The APi will only check if a URL returns a valid HTTP status code (not 4xx or 5xx). After the status is returned, the task is marked as COMPETED.

callback

string

optional

The callback url is provided by the consumer in the form of a JSON post request. Sketchy will post a completed or failed job to the callback url provided. The request will be JSON.

job_status

string

The job_status is used to track the task status as the task executes. The following values are used:

  • CREATED - The job has been created.
  • STARTED - The job has been started by Celery.
  • RETRY - The job has retried due to an exception
  • FAILURE - The job has failed.
  • COMPLETED - The task has completed successfully.

When a task is finished, capture_status is updated with the value of COMPLETED.

apture_status

string

The capture_status is updated as the task is running. In the event there is an unexpected error, the capture_status will be updated with that error message. In the event the URL provided returns a 4xx or 5xx status code, capture_status will be set to '404'.

When a task is finished, capture_status is updated with the value of COMPLETED.

created_at

string

This attribute is created when the API receives a POST. This returns a string that is formatted with datetime.now()

modified_at

string

This attribute is modified when each time the Capture record is modified. This returns a string that is formatted with datetime.now()

retry

integer

This attribute displays the number of times a task was retried.

sketch_url

string

The sketch_url contains the location of the screen capture that was generated by PhantomJS. The sketch_url will either point to a S3 link or locally depending on your configuration settings.

scrape_url

string

The scrape_url contains the location of the text that was scraped from the URL provided to PhantomJS. The scrape_url will either point to a S3 link or locally depending on your configuration settings.

html_url

string

The html_url contains the location of the html file capture that was generated by PhantomJS. The html_url will either point to a S3 link or locally depending on your configuration settings.

Static Model

The static model is identical to the Capture model with two changes. url is replaced with filename and status_only is removed.

NOTE: url, and callback are provided in the Multipart POST request to the Sketchy API.

  • filename
  • status_only
  • callback
  • job_status
  • capture_status
  • created_at
  • modified_at
  • retry
  • sketch_url
  • scrape_url
  • html_url

filename

string

The filename contains the name of the html file being uploaded to Sketchy. The filename must end in the html or htm file extension to be accepted.

See Capture Model above for more details on the model attributes.