You can use the SMS Gateway API to get a get details on a specific device. This will provide you with information regarding the status of your Android phone.
Below is some sample requests and response. For complete API documentation on getting an android device information please refer to the Swagger (Open API Specification) documentations here: SMS Gateway API Definition
Request Endpoint | |||
---|---|---|---|
Endpoint: | https://smsgateway.me/api/v4/device/{id} | ||
Method: | GET | ||
Request Parameters | |||
Name | Location | Required | Description |
Authorization | header | true | Your API token found on the settings page |
id | path | true | The ID of the device you are trying to fetch |
A GET request with the device id provided in the path
{
"GET": "https://smsgateway.me/api/v4/device/123456"
}
Successful Response
A successful request will bring back device information
Response Code: 200
{
"attributes": {
"phone_number": "07791064781",
"make": "Samsung",
"model": "SM-J320F",
"provider": "EE",
"country": "gb",
"connection_type": "4G",
"battery": 100,
"signal_percent": 75,
"wifi": true,
"lat": "-0.2356489",
"lng": "0.2456489",
"last_seen": "2018-05-05T16:10:49+00:00"
},
"id": 123456,
"name": "Device 123456"
}
Error Response
When a request can not be processed
Response Code: 40x | 500
{
"status": "fail",
"message": "Could not process request",
"data": {
"exception": "Error message"
}
}
You can use our Swagger generated PHP SDK to help integrate with our service. If you wish to use SMS Gateway Me with a different platform you may generate your own client using the swagger file.
Installation Instructions: PHP SMS Gateway SDK
Swagger Definition: SMS Gateway API Definition
<?php
// Include library
require 'vendor/autoload.php';
// Import dependancies
use SMSGatewayMe\Client\ApiClient;
use SMSGatewayMe\Client\Configuration;
use SMSGatewayMe\Client\Api\DeviceApi;
// Configure client
$config = Configuration::getDefaultConfiguration();
$config->setApiKey('Authorization','your-token-here');
$apiClient = new ApiClient($config);
// Create device client
$deviceClient = new DeviceApi($apiClient);
// Get device information
$device = $deviceClient->getDevice(1);
print_r($device);
SMSGatewayMe\Client\Model\Device Object
(
[id:protected] => 1
[name:protected] => Device Name
[attributes:protected] => SMSGatewayMe\Client\Model\DeviceAttributes Object
(
[phoneNumber:protected] => 07791064781
[make:protected] => samsung
[model:protected] => SM-G965F
[provider:protected] => EE
[country:protected] => gb
[connectionType:protected] => 4G
[battery:protected] => 43
[signalPercent:protected] =>
[wifi:protected] =>
[lat:protected] => 52.6076925
[lng:protected] => -0.2046643
[lastSeen:protected] => DateTime Object
(
[date] => 2018-05-14 17:36:20.000000
[timezone_type] => 1
[timezone] => +00:00
)
)
)