getJobs

Prev Next

Available in Classic and VPC

Get the list of diagnostics registered by the user from the NAVER Cloud Platform console and output the result.

Request

This section describes the request format. The method and URI are as follows:

Method URI
GET /jobs

Request headers

For headers common to Web Security Checker, see Web Security Checker common request headers.

Request query parameters

The following describes the parameters.

Field Type Required Description
limit Integer Required Number of output items per page in the list
page Integer Required Page number of the list

Request example

The request example is as follows:

curl --location --request GET 'https://wsc.apigw.ntruss.com/api/v1/jobs
?limit=10
&page=1'
--header 'x-ncp-apigw-timestamp: {Timestamp}'
--header 'x-ncp-iam-access-key: {Access Key}'
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'
--header 'Content-Type: application/json'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
total_cnt Integer - Total number of job records
total_page_cnt Integer - Last page
current_start_page Integer - Starting page number (increments of 10)
current_end_page Integer - Last page number (increments of 10)
record_data Array - Diagnosis list
record_data[].instanceNo Integer - Identification number of the diagnostic job
record_data[].start_date Date - Diagnostic job start time
record_data[].end_date Date - Diagnostic job end time
record_data[].status String - Diagnostic job status
record_data[].progress Integer - Diagnostic progress
record_data[].start_url String - Diagnosis target URL
record_data[].crawl_cnt Integer - Crawling URL collection count
record_data[].scan_cnt Integer - Vulnerability count
record_data[].memo String - Job notes
record_data[].result_button String - Job status
  • report | cancel | terminate | expired | cause
    • report: report printable
    • cancel: job canceled
    • terminate: job stopped
    • expired: expired
    • cause: error occurred while the job was in progress
record_data[].result_desc String - Job result details
  • Detailed output on job errors
record_data[].rescan_button String - Re-diagnostic availability
  • possible | expired | null
    • possible: re-diagnostic available
    • expired: re-diagnostic unavailable due to expiration
    • null: re-diagnostic unavailable
record_data[].slave_data Array - Re-diagnostic list

Response status codes

For error codes common to Web Security Checker APIs, see Common Web Security Checker error codes.

Response example

The response example is as follows:

  • Query completed: If there is query information
{
    "returnCode": "0",
    "returnDesc": "Request Success",
    "returnMessage": "Success",
    "resources": {
        "total_cnt": 1,
        "total_page_cnt": 1,
        "current_start_page": 1,
        "current_end_page": 1,
        "record_data": [
            {
                "instanceNo": "1234567890",
                "start_date": "2024-07-08 13:12:03",
                "end_date": "2024-07-08 13:15:10",
                "status": "Diagnostics completed",
                "progress": null,
                "start_url": "http://your-domain",
                "crawl_cnt": "1",
                "scan_cnt": "1",
                "memo": "Sample",
                "result_button": "report",
                "result_desc": "",
                "rescan_button": "possible",
                "slave_data": null
            }
        ]
    }
}
  • Query completed: If there is no query information
{
    "returnCode": "0",
    "returnDesc": "Request Success",
    "returnMessage": "Success",
    "resources": {
        "total_cnt": 0,
        "total_page_cnt": 0,
        "current_start_page": 0,
        "current_end_page": 0,
        "record_data": null
    }
}

Sample code

The following is a sample code that generates a signature with the make_signature function to create a request head, then queries the diagnostic list based on the request parameters entered, outputting the result if the response code is 200.

import sys
import os
import hashlib
import hmac
import base64
import requests
import time

def make_signature(method, uri, timestamp):

    access_key = "{accessKey}"  # access key id (from portal or sub account)
    secret_key = "{secretKey}"  # secret key (from portal or sub account)
    secret_key = bytes(secret_key, 'UTF-8')

    method = method
    uri = uri

    message = method + " " + uri + "\n" + timestamp + "\n" + access_key
    message = bytes(message, 'UTF-8')
    signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest())
    return signingKey

timestamp = str(int(time.time() * 1000))

method = 'GET'
uri = '/api/v1/jobs?page=1&limit=10'

signature = make_signature(method, uri, timestamp)

headers = {
    'x-ncp-apigw-signature-v2': signature.decode('utf-8'),
    'x-ncp-apigw-timestamp': timestamp,
    'x-ncp-iam-access-key': '{accessKey}', # access key id (from portal or sub account)
    'Content-Type': 'application/json'
}

response = requests.request(
    method,
    f"https://wsc.apigw.ntruss.com{uri}",
    headers=headers
)

if response.status_code == 200:
    print(response.text)
Note

The sample code is written in Python 3. See Call API in the API Gateway user guide for sample code written in other languages, such as Java and Node.js.