Code example Skip Navigation

Code example

Device submit a HTTP POST request to
BEMS
.
[Http Header]
Contains the auth information.
The following are the headers of an example request:
POST /api/lookupuser HTTP/1.1 Host: localhost:8443 Connection: keep-alive Content-Length: 141 Accept: application/json, text/javascript, */*; q=0.01 X-Good-GD-AuthToken: M3xtYXR0bG9jMUBleDM2NS5xYWdvb2QuY29tfDY4MzE2MzExLUJBN0MtNDU0NC05R...oRT0= User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) Content-Type: application/json; charset=UTF-8 Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4
[POST body]
{"Account":"testuser@example.com","SearchKey":"James","MaxNumber":10,"UserShape":["GivenName", "Surname", "Photo","WeddingAnniversary"]}
[Response Header]
HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Transfer-Encoding: chunked
[Response Body]
[{"GivenName":"James", "Surname":"Lambier", "Photo":"dG9tIGp1bmp1biBsaXUncyBwaG90bw=="}, {"GivenName":"James", "Surname":"Lambier"}]
If the device requests any property not yet understood by the
BEMS
server (for example,"WeddingAnniversary"),
BEMS
will retrieve as many properties as possible and include only those properties that are found, understandable, and supported in the JSON response. If an unexpected error occurred during the lookup handling,
BEMS
returns a non 200 HTTP response code.