getJobs
    • PDF

    getJobs

    • PDF

    Article summary

    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

    The following describes the request format for the endpoint. The request format is as follows:

    MethodURI
    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.

    FieldTypeRequiredDescription
    limitIntegerRequiredNumber of output items per page in the list
    pageIntegerRequiredPage number of the list

    Request example

    The following is a sample request.

    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

    The following describes the response format.

    Response body

    The following describes the response body.

    FieldTypeRequiredDescription
    total_cntInteger-Total number of job records
    total_page_cntInteger-Last page
    current_start_pageInteger-Starting page number (increments of 10)
    current_end_pageInteger-Last page number (increments of 10)
    record_dataArray-Diagnosis list
    record_data[].instanceNoInteger-Identification number of the diagnostic job
    record_data[].start_dateDate-Diagnostic job start time
    record_data[].end_dateDate-Diagnostic job end time
    record_data[].statusString-Diagnostic job status
    record_data[].progressInteger-Diagnostic progress
    record_data[].start_urlString-Diagnosis target URL
    record_data[].crawl_cntInteger-Crawling URL collection count
    record_data[].scan_cntInteger-Vulnerability count
    record_data[].memoString-Job notes
    record_data[].result_buttonString-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_descString-Job result details
    • Detailed output on job errors
    record_data[].rescan_buttonString-Re-diagnostic availability
    • possible | expired | null
      • possible: re-diagnostic available
      • expired: re-diagnostic unavailable due to expiration
      • null: re-diagnostic unavailable
    record_data[].slave_dataArray-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 following is a sample example.

    • 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.


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.