Get Lovense App Info
This guide will show you how to get Lovense app info. You may need to get Lovense app info when integrating with the Lovense Basic API or Standard API.
Guide
You can get the local Lovense app info in three ways:
- Use Get App Info List API get App Info Object list
- Receive App Info Object when the user use Lovense Remote/Connect scan the QR code
- Get app connect information in app view
Way 1: Select App
Lovense Remote
Open Lovense Remote Game Mode
Use Get App Info List API API get App Info Object list on the local network
Let user select app by code
Lovense Connect
Open connection infomation view in Lovense Connect
Use Get App Info List API API get App Info Object list on the local network
Let user select app by code
Way 2: Scan QR Code or Input Code on Lovense App
Use Generate QR Code to generate QR code and string code
Show QR code to user or show string code
User use Lovense Mobile Remote/Connect scan QR code or input string code
Receive App Info Object from your Callback URL
Way 3: Input ip and port
Lovense Remote
Open Lovense Remote third-party control mode
Get connect ip address from Lovense Remote connect infomation view
User input connect ip address to your app
Lovense Connect
Open connection infomation view in Lovense Connect
Get local ip address from Lovense Connect
User input connect ip address to your app
API
Get List of local Apps
curl -X GET https://api.lovense-api.com/api/lan/v2/app
API URL: https://api.lovense-api.com/api/lan/v2/app
Request Protocol: HTTPS Request
Method: GET
Response Content Type: application/json
Response:
Name | Description | Type |
---|---|---|
code | Return code, 0 means success, others mean failure. See Response Code for details. | int |
message | When the request fails, the reason for the failure will be returned. | string |
data | Response data | App Info Object[] |
Response data example:
{
"code": 0,
"data": {
"deviceCode": "xxxxxx",
"deviceId": "xxxxxxx",
"online": true,
"domain": "192-168-1-xx.lovense.club",
"httpsPort": 30010,
"wssPort": 30110,
"appVersion": "1.3.7",
"platform": "android",
"appType": "remote",
"toyList": []
}
}
Get local app by code
Get local network connection information from the Lovense App using the Device Code.
curl -X GET https://api.lovense-api.com/api/lan/v2/app/{deviceCode}
API URL: https://api.lovense-api.com/api/lan//v2/app/{deviceCode}
Request Protocol: HTTPS Request
Method: GET
Response Content Type: application/json
Response:
Name | Description | Type |
---|---|---|
code | Return code, 0 means success, others mean failure. See Response Code for details. | int |
data | Response data | App Info Object |
Response data example:
{
"code": 0,
"data": {
"deviceCode": "xxxxxx",
"deviceId": "xxxxxxx",
"online": true,
"domain": "192-168-1-xx.lovense.club",
"httpsPort": 30010,
"wssPort": 30110,
"appVersion": "1.3.7",
"platform": "android",
"appType": "remote",
"toyList": []
}
}
Generate QR Code
String url= "https://api.lovense-api.com/api/lan/v2/qrcode";
Map<String, String> requestParameter = new HashMap<String, String>();
//TODO initialize your parameters:
requestParameter.put("token", "{Lovense developer token}");
requestParameter.put("uid", "{user ID on your website}");
requestParameter.put("uname", "{user nickname on your website}");
requestParameter.put("utoken", "{Encrypted user token on your application. This is a security consideration, to avoid others stealing control of the toy.}");
requestParameter.put("v", 2);
HttpPost httpPost = new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
if (requestParameter != null && !requestParameter.isEmpty()) {
Set<String> keys = requestParameter.keySet();
for (String key : keys) {
nameValuePairs.add(new BasicNameValuePair(key, requestParameter.get(key)));
}
}
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8"));
const result = async axios.post('https://api.lovense-api.com/api/lan/v2/qrcode',
{
token: 'your developer token', // Lovense developer token
uid: '11111', // user ID on your website
uname: 'user name', // user nickname on your website
utoken: md5(uid + 'salt'), // This is for your own verification purposes. We suggest you to generate a unique token/secret for each user. This allows you to verify the user and avoid others faking the calls.
v: 2
}
)
Call Lovense Server API from your server
API URL: https://api.lovense-api.com/api/lan/v2/qrcode
WARNING
Notice: For security reasons, the developer token should be always used on the server side. You should never use it in your client side.
Request Protocol: HTTPS Request
Method: POST
Content Type: application/json
Parameters:
Name | Description | Required |
---|---|---|
token | Developer Token | yes |
uid | User ID on your application | yes |
uname | User ID on your application | no |
utoken | User token from your website. This is for your own verification purposes. We suggest you generate a unique token for each user. This allows you to verify the user and avoid others faking the calls. | no |
Request Example:
{
"token": "FE1TxWpTciAl4E2QfYEfPLvo2jf8V6WJWkLJtzLqv/nB2AMos9XuWzgQNrbXSi6n",
"uid": "your user id",
"uname": "your user name",
"utoken": "your user token"
}
Return:
Name | Description | Type |
---|---|---|
code | Return code, 0 means success, others mean failure. See Response Code for details. | int |
message | When the request fails, the reason for the failure will be returned. | string |
data | qrcode data | object |
data.qrcodeUrl | qrcode picture url | string |
data.qrcode | qrcode string, you can use it to generate QR codes. | string |
example:
{
code: 0
message: "Success"
data: {
"qrcodeUrl": "https://api.lovense-api.com/UploadFiles/qr/20220106/xxxx.jpg", // qrcode picture
"qrcode": "xxxxxxxxxxxxxxxxxxxx"
}
}
TIP
The QR code will expire after 4 hours.
Post Callback URL Data
Provide your Callback URL to us get the local app information.
When user scan the QR code, the system will post App Info Object to your callback URL, use HTTP POST method with application/json; charset=utf-8
content type and Custom-Header: api-version=2
header.
Objects
App Info Object
Name | Description | Type |
---|---|---|
deviceCode | Client identification code. | string |
online | Whether the channel used to forward instructions from the Lovense server is connected. | boolean |
domain | App connect domain | string |
httpsPort | HTTPS Port | int |
wssPort | websocket Port | int |
platform | Platform | string |
appVersion | App version | string |
appType | App type | string |
toyList | Toy list | Toy Object[] |
example:
{
"deviceCode": "xxxxxx",
"online": true,
"domain": "192.168.1.xx.lovense.club",
"httpsPort": 30010,
"wssPort": 30110,
"appVersion": "1.3.7",
"platform": "android",
"appType": "remote",
"toyList": [
{
"id": "xxxxxxxx",
"name": "Lush 3",
"toyType": "lush",
"nickname": "My Lush",
"hVersion": "3",
"fVersion": 300,
"battery": 100,
"connected": true
}
]
}
Toy Object
Name | Description | Type |
---|---|---|
id | Toy ID. | string |
toyType | Toy type. | string |
nickname | Toy nickname. | string |
fVersion | Toy firmware version. | int |
hVersion | Toy hardware version. For example, Lush is "" , and Lush 2 is "2" . | string |
battery | Toy power, -1 ~100 . -1 : The power is not obtained or the toy has no battery. | int |
connected | Toy's connection status. true : conencted, false : disconnected | int |
example:
{
"id": "xxxxxxxx",
"name": "Lush 3",
"toyType": "lush",
"nickname": "My Lush",
"hVersion": "3",
"fVersion": 300,
"battery": 100,
"connected": true
}
Other
Response Code
Code | Description |
---|---|
0 | Success |
404 | Invalid Parameter |
500 | Server Error |
501 | Invalid token |
502 | Invalid Callback URL |