SORACOM offers an API that can be used to access the SORACOM platform from external programs. Details on the API are listed in the API reference, which lets you not only confirm how it works, but interactively call the API.
In this FAQ, we use the updateSpeedClass API as an example of how to call the API.
Using the API reference to call the SORACOM API
1. API authorization
Authentication on the API can be done by two means: using an authentication key or from your account in the SORACOM User Console. In this FAQ, we describe how to use the SORACOM User Console for authentication.
Enter your SORACOM User Console account e-mail address and password and click the Authenticate button.
If “Authentication OK” is displayed below the authentication button, your authentication is complete. This will allow you to call the API reference.
2. API execution
Authenticating your account will allow you to physically call the API from the API reference.
- The API called from the API reference only works against authenticated accounts.
- Not only does this API allow you to throttle speed for individual SIMs on SORACOM Air, but deactivate and terminate SIMs, among other features. Therefore, exercise caution when testing so as not to alter settings in an unwanted fashion.
- Note that calling the API will incur actual service charges.
In this FAQ, we describe the updateSpeedClass API as one example of using the API to change SIM speed.
First, select the updateSpeedClass API from the Subscriber index.
Click the API name to display details on the API.
Parameters shows a list of parameters used when calling an API. Fields listed as “required” in the Value field are those required for input.
In this case, the imsi and speed_class fields are required.
For speed_class, enter the speed class for the given SIM card in JSON format. Parameters using JSON format are described in the Model and Model Schema sections on the right of the field.
After filling in the parameters, click the “Try it out!” button.
3. Check results of API execution
Clicking the “Try it out!” button will return the results of the command. The meaning of the actions returned is as follows.
Examples of using the curl command when launching the API This can be used when calling the API from a script.
This prints the result of the API function. You can check your settings and desired outcome here.
This is an HTTP response code displaying the output of the API. In this example, HTTP Response Code: 200 OK was returned, showing that the API command succeeded.
If the API call failed, it will return HTTP Response Code: 4xx or 5xx. A common error is HTTP Response Code: 400 Bad Request. This Response Code indicates that there was an error in the request parameters, so you can check whether the parameters were entered correctly.
This concludes our summary of using the API reference. Other APIs can be called in the same fashion.