For large-scale client creation and deployment there are two API calls:
The purpose of these functions is to create a new client and to download its script via API. They can be used in IoT devices; for instance, after the first boot in the factory, the device can call the create_new_client
and create its client and then download the script and install it on the device. This way the sshreach.me client will be automatically installed and ready and the device can be accessed if necessary.
You can access the api calls templates and the api key on your key management page
create_new_client
api_key
- your api keyregion
- region to which you want your client to connect to.type
- [serial
|random
] - (default: serial) serial creates a 6-digit numbered client name starting from 000001 with prefix (if submitted), while random creates a 20-character random string client nameprefix
- (default: none) prefix for serial type of client names. With this parameter you can have multiple classes of serial numbers and you can distinguish your IoT devicesname
- in case you have a predefined names for your clients, you can send the name of the clientfwport
- (default: 22) - port to forwardusername
- (default: none) a username that will be used to connect to your clientOn success create_new_client returns the following json
{"message": "OK", "error_code": 0, "success": true, "client_name":"cli000123", client_id: "dfb39cdd-9140-4d74-9e26-a2f00bc3bad2"}
You can then use the client_id to get the client script for the newly created client
error codes
00 - ok
21 - invalid API call
23 - Client blocked
24 - Client inactive
31 - Wrong data
32 - Invalid API key or API key missing
40 - Cannot access forwarding server
41 - Invalid region key
45 - Internal error
get_client_script
This function returns the client script for the client whose ID is sent in the client_id parameter.
api_key
- your api keyclient_id
- client_id of the client whose script we want to downloaddevice_list
this function lists all created client and returns their details in a json list of dictionaries which contain the client data:
[{"host_name": "12345", "host_id": "f2saddsc-8123-23s1-2321-9sadfdc43aba52", "client_id": "f2saddsc-8123-23s1-2321-9sadfdc43aba52", "tunnel_open": false, "client_active": false, "forwarding_server": "fw1.sshreachme-trial.com", "username": "asdf", "port": 3243, "user_id": 0, "ports_id": 1, "dbid": "234s234dg34568dfgIUag4", "last_ping_time": "2023-06-19T18:05:17Z"}]
api_key
- your api keydelete_client
This function deletes the client script
The api call template and the api key for this function can also be found on the key management page
api_key
- your api keyclient_id
- client_id of the client that we want to delete (you can find the CLIENT_ID in the python script under the name HOST_UUID or as a result of device_list API call).