MENU
      searchJobs

        searchJobs


        Article summary

        Available in Classic and VPC

        Filter the list of diagnostics registered by the user in the NAVER Cloud Platform console by specific diagnostic details, such as search type and job status, and output the results.

        Request

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

        MethodURI
        POST/search

        Request headers

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

        Request body

        The following describes the request body.

        {
            "searchType": "url",
            "searchKeyword": "http://your-domain",
            "statusCode": null,
            "limit": 10,
            "page": 1
        }
        JSON
        FieldTypeRequiredDescription
        searchTypeStringRequiredSearch type
        • url | memo | blank
          • url: Enter a domain or URL in searchKeyword such as ncloud.com
          • memo: Enter the note string you entered when creating the task into searchKeyword
          • Blank: Search all
        searchKeywordStringRequiredSpecify search keywords that correspond to searchType
        statusCodeIntegerRequiredSearch by job status code
        • null: Search all
        • 2: diagnostic pending
        • 3: diagnostic in progress
        • 4: diagnostic completed
        • 5: diagnostic failed
        • 12: URL collection pending
        • 13: URL collection in progress
        • 14: URL collection completed
        • 15: URL collection failed
        • 91: diagnostic canceled
        • 92: stopping
        • 93: job stopped
        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 POST 'https://wsc.apigw.ntruss.com/api/v1/jobs/search'
        --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'
        --data '{"searchType": "url",
        "searchKeyword": "http://your-domain",
        "statusCode": null,
        "limit": 10,
        "page": 1}'
        Curl

        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 job
        record_data[].start_dateDate-Diagnostic job start time
        record_data[].end_dateDate-Diagnostic job end time
        record_data[].statusString-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-

        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
                    }
                ]
            }
        }
        JSON
        • 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
            }
        }
        JSON

        Sample code

        The following is a sample code that generates a signature with the make_signature function to create a request head, and then queries the diagnostic list for a specific status 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
        import json
        
        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 = 'POST'
        uri = '/api/v1/jobs/search'
        payload = {
          "searchType": "url",
          "searchKeyword": "user-domain",
          "statusCode": None,
          "limit": 1,
          "page": 1
        }
        
        timestamp = str(int(time.time() * 1000))
        
        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,
            data=json.dumps(payload), # Json format required
        )
        
        if response.status_code == 200:
            print(response.text)
        Python
        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?

        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.