Examples of API calls¶
Requests to the server part¶
Important
The following examples use https://cloud.solidpoint.net as the address of the scanner instance. When making requests, you must use a personal address.
-
Specify the token in the
X-Tokenheader for subsequent use in authentication (more information on the Token Authentication page):
-
Authenticate via Cookies:
-
Authenticate via bearer token:
-
Change the password for the super administrator (single user mode):
-
Log in as a super administrator:
-
Register in the system:
-
Log in to the system:
-
Log out of the system:
-
Create a new tenant:
-
Add or remove a restriction on the client's hostname:
Requests to the scanner¶
-
Add an endpoint for scanning:
-
Update the endpoint for scanning:
-
Get an endpoint by ID:
-
Get all endpoints:
-
Add or remove tenant endpoints:
-
Get a tenant by ID:
-
Get a list of all tenants:
-
Get a list of all users with a given role in a certain tenant:
-
Add a user to the tenant:
curl --location --request POST 'https://cloud.solidpoint.net/api/users' --header 'Content-Type: application/json' --header 'Cookie: auth_token=jwt' --data-raw '{ "tenantName": "test", "email": "user@test.ru", "password": "testuser123", "name": "user", "role": "user", "companyName": "test", "occupation": "test" }'
-
Activate a user by ID (you can specify
tenantNameinstead oftenantId):
-
Activate a user by email (you can specify
tenantNameinstead oftenantId):
-
Activate of all users:
Work with scans¶
-
Start a new scan (you can use
urlinstead oftargetID):
-
Complete a scan by ID:
Examples of working with scan authentication parameters¶
Scan authentication parameters are handled through targets.
-
Work with HTTP Basic Auth:
-
Work with Cookies:
-
Work with Headers:
-
Work with certificates:
-
Change all authentication parameters to a certificate:
If a target has many different authentication parameters, then they can either be overwritten or reset to zero. This is done by sending an additional parameter
rewriteAppAuth. For example, a target has HTTP Basic Auth and Cookies, but needs to have only a certificate. In this case only the certificate needs to be sent with the additional parameterrewriteAppAuth. When zeroing out, only one additionalrewriteAppAuthparameter must be sent.
-
Add LDAP Authentication:
curl --location --request POST 'https://cloud.solidpoint.net/api/auth' --header 'Content-Type: application/json' --header 'Cookie: auth_token=jwt' --data '{ "type": "LDAP", "parameters": { "label": "ldap", "host": "dev.solidwall.io", "port": 636, "baseDN": "ou=users,dc=solidwall,dc=io", "uid": "uid", "defaultAttributes": true, "tls": true, "roles": { "user": "objectClass=inetOrgPerson" } } }'
-
Get a list of all configured authentications:
-
Update authentication (URL contains record ID):
When updating parameters, they must be passed as a whole, as the nested key goes as the full value.
-
Delete an existing record (the URL contains the record ID):
Examples of working with the specification for scans¶
Working with the specification for scans is done via targets. The specification is passed in base64 format (... is the designation in the examples below).
-
Create a target with a specification:
-
Add a specification to an existing target:
curl --location --request PATCH 'https://cloud.solidpoint.net/api/targets/2' --header 'Content-Type: application/json' --header 'Cookie: auth_token=jwt' --data '{ "specification": { "openAPI": { "specification": "..." }, "disabled": false } }'The
disabledparameter is responsible for passing the specification to the scan. Ifdisabled: true, the specification will not be passed to the scan request.The target specification can also be either overwritten or reset to zero. This is done by sending an additional parameter
rewriteSpec. For example, a target has several specifications, but it needs to have only one. In this case, only the required specification needs to be sent with the additional parameterrewriteSpec. When zeroing out, you need to send only therewrite Specparameter.Important
When zeroing out, the
disabledparameter gets set tofalse, but the specification will not get fetched during the scan, since it is empty (zeroed).
-
Transfer scans from the default tenant: