Thanks again. Look forward to seeing better improved documentation in the future.
Original Message:
Sent: Thu September 14, 2023 04:01 AM
From: Oktawian Powązka
Subject: REST API for uploading disconnected scan results
I'll take this into consideration for this doc update task...
------------------------------
Thank you,
Oktawian
Oktawian Powązka, L3 Support
IBM License Metric Tool
------------------------------
Original Message:
Sent: Wed September 13, 2023 10:39 AM
From: York Ly
Subject: REST API for uploading disconnected scan results
Thanks Oktawian, you are the best and life saver. I have spent over an hour trying to figure out these error messages below especially "The 'filename' parameter is not specified............." message. No idea why it kept failing with missing filename parameter even it was defined.
Then other errors just did not make sense to me. See below.
Unnecessary use of -X or --request, POST is already inferred.
* Could not resolve host: Source
* Closing connection 1
curl: (6) Could not resolve host: Source
Driving me crazy yesterday. Usually, providing a double quote such as "Data Source 2" would handle the spacing. The error should have indicated missing the "datasource_name" parameter instead of "filename" parameter.
====================
"success":false,"message":"The 'filename' parameter is not specified. Specify the parameter."}* Closing connection 0
* schannel: shutting down SSL/TLS connection with 192.168.0.182 port 9081
Note: Unnecessary use of -X or --request, POST is already inferred.
* Could not resolve host: Source
* Closing connection 1
curl: (6) Could not resolve host: Source
Note: Unnecessary use of -X or --request, POST is already inferred.
* Closing connection -1
curl: (3) URL using bad/illegal format or missing URL
===========
So I updated my curl statement with "Data%20Source%202" and it worked perfectly.
curl --insecure -v -H "Accept:application/json" -H "Token:e679f8777c87e5889fe9df54e8d8e6eb9a8263a4" -H "Content-Type:application/octet-stream" --data-binary "@D:/Downloads/LMT-DisconnectedScanner-windows-9.2.32.0-20230621-0049/output/202309122119-DESKTOP-US1K34G-4c4e2cde-87ff-49fc-8305-275d17a61913-1694553293.zip" -X POST "https://192.168.0.182:9081/api/sam/v2/scan_results_upload?datasource_name=Data%20Source%202&filename=202309122119-DESKTOP-US1K34G-4c4e2cde-87ff-49fc-8305-275d17a61913-1694553293.zip"
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 192.168.0.182:9081...
* Connected to 192.168.0.182 (192.168.0.182) port 9081 (#0)
* schannel: disabled automatic use of client certificate
* schannel: using IP address, SNI is not supported by OS.
* ALPN: offers http/1.1
* ALPN: server did not agree on a protocol. Uses default.
* using HTTP/1.x
> POST /api/sam/v2/scan_results_upload?datasource_name=Data%20Source%202&filename=202309122119-DESKTOP-US1K34G-4c4e2cde-87ff-49fc-8305-275d17a61913-1694553293.zip HTTP/1.1
> Host: 192.168.0.182:9081
> User-Agent: curl/8.0.1
> Accept:application/json
> Token:e679f8777c87e5889fe9df54e8d8e6eb9a8263a4
> Content-Type:application/octet-stream
> Content-Length: 22636
>
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Strict-Transport-Security: max-age=31536000
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Referrer-Policy: strict-origin-when-cross-origin
< Strict-Transport-Security: max-age=31536000
< Content-Language: en
< Expires: Fri, 01 Jan 1990 00:00:00 GMT
< Access-Control-Allow-Origin: *
< Content-Security-Policy: default-src 'self'; img-src 'self' data: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: ; script-src-elem 'self' 'unsafe-inline' data: ; font-src 'self' data: ;
< Content-Type: text/plain; charset=utf-8
< Cache-Control: private, no-store, no-cache, max-age=0, must-revalidate
< Content-Length: 78
< ETag: W/"a94a3e2e4ca9528ff7a8b5b8d629779b"
< Set-Cookie: _DSS_session=RDcxV3p1czdoUURhRjUxdU5QSWkwdFcreklndGpOWGpDNU91WFRucHlsNTVsT25oMWhFV1dBM0o4NEhJSTVZcGVhSXlJTHV6cGlWSnp6b0g0eWpHVy9mQ3JaUi9nMVI5UVpKdUhrMGNvdVZrWC8wcmZleUliSjdOeDRocE5XcmJidUJ4ektyVHBTTk92cy84c3lpaDRnPT0tLTY2U0VOQ25LT3RDT0I1ajBUTGpYekE9PQ%3D%3D--3515829e1362a7a85a6c69457bc914cf5a8b1322; path=/; secure; HttpOnly
< X-Request-Id: 3de37aee-5811-49f6-874d-8544f611485c
< X-Runtime: 0.187654
< Date: Wed, 13 Sep 2023 14:18:12 GMT
<
{"success":true,"message":"File with scan results was uploaded successfully."}* Connection #0 to host 192.168.0.182 left intact

Oktawian, as I mentioned early that documentation is very very important for everyone. Missing information can really cause a lot of pain and wasting human resources to diagnose the issue. Providing a very very details and good example how to do thing is extremely important for users. Providing a sample format or formula is a good start but it also needs the actual sample on how to use it and fill in the information such as this case. You know where the problem is, why not document such requirement/information.
I know there are a lot more REST API calls in the documentation which don't provide a good sample scenario how to use it or fill in the information. I recommend someone go through them and update the documents and provide some good real life examples so reader or user can easily understand and use it.
Thanks again for your quick response.
Have a look at this link below where it documented a syntax + a good example follow. That is what it should be included in ILMT document where it is needed to further clarify how to populate the information in the syntax.
https://www.ibm.com/docs/en/license-metric-tool?topic=certificate-step-1-creating-private-keys-certificates
Appreciated.
------------------------------
York Ly
Original Message:
Sent: Wed September 13, 2023 05:01 AM
From: Oktawian Powązka
Subject: REST API for uploading disconnected scan results
Hello York,
Following is a syntax for your case scenario:
curl --insecure -v -H "Accept:application/json" -H "Token:xxx" -H "Content-Type:application/octet-stream" --data-binary "@D:/Downloads/LMT-DisconnectedScanner-windows-9.2.32.0-20230621-0049/output/202309122119-DESKTOP-US1K34G-4c4e2cde-87ff-49fc-8305-275d17a61913-1694553293.zip" -X POST "https://192.168.0.182:9081/api/sam/v2/scan_results_upload?datasource_name=Data%20Source%202&filename=202309122119-DESKTOP-US1K34G-4c4e2cde-87ff-49fc-8305-275d17a61913-1694553293.zip"
Basically, If disconnected data source name contains a space it needs to be replaced by '%20' character.
I've requested a doc update...
------------------------------
Thank you,
Oktawian
Oktawian Powązka, L3 Support
IBM License Metric Tool