Get UID and Token
API
Get a unique Lovense UID and token for use with Lovense Pattern Editor initialization
API URL: https://api.lovense-api.com/api/server/peditor/v1/uid?user={user-id}&pkey={secret-key}&platform={platform}
Request Protocol: HTTPS Request
Method: GET
Request Content Type: application/json
Parameters:
Parameters | Description | Type | Required |
---|---|---|---|
secret-key | A secret key generated by Lovense. Please contact us to obtain the key. Never reveal the secret-key on the client side. | string | Yes |
user-id | Your user's ID from your platform. Up to 1000 characters. | string | Yes |
platform | Contact us to confirm this | string | Yes |
Response Format: JSON
Response:
name | type | description |
---|---|---|
uid | string | For video patterns initialization. |
token | string | For video pattern initialization. Valid time is 24 hours, if a new token is generated with the same user-id and platform , the old token will be invalidated. |
Request Example:
Sample response:
{
"uid": "fx1adxzxcasdq2", // uid
"token": "token" // video pattern token
}
⚠️ For security reasons, to avoid
secret-key
exposure we recommend to perform such requests from server side only, not from the client side.
Example
// <dependency>
// <groupId>org.apache.httpcomponents</groupId>
// <artifactId>httpclient</artifactId>
// <version>4.5.10</version>
// </dependency>
import org.apache.http.HttpEntity;
import org.apache.http.HttpHeaders;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
public class HttpClientExample1_1 {
public static void main(String[] args) throws IOException {
CloseableHttpClient httpClient = HttpClients.createDefault();
try {
HttpGet request = new HttpGet("https://api.lovense-api.com/api/server/peditor/v1/uid?user=[user-id]&pkey=[secret-key]&platform=[Website Name]");
CloseableHttpResponse response = httpClient.execute(request);
try {
System.out.println(response.getStatusLine().getStatusCode()); // 200
HttpEntity entity = response.getEntity();
if (entity != null) {
// return it as String
String result = EntityUtils.toString(entity);
System.out.println(result);// result
}
} finally {
response.close();
}
} finally {
httpClient.close();
}
}
}