- Print
- PDF
searchJobs
- Print
- PDF
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:
Method | URI |
---|---|
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
}
Field | Type | Required | Description |
---|---|---|---|
searchType | String | Required | Search type
|
searchKeyword | String | Required | Specify search keywords that correspond to searchType |
statusCode | Integer | Required | Search by job status code
|
limit | Integer | Required | Number of output items per page in the list |
page | Integer | Required | Page 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}'
Response
The following describes the response format.
Response body
The following describes the response body.
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 job |
record_data[].start_date | Date | - | Diagnostic job start time |
record_data[].end_date | Date | - | Diagnostic job end time |
record_data[].status | String | - | 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
|
record_data[].result_desc | String | - | Job result details
|
record_data[].rescan_button | String | - | Re-diagnostic availability
|
record_data[].slave_data | Array | - |
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, 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)
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.