2017-04-25 19:27:54 +08:00
|
|
|
|
# irext Java web API
|
|
|
|
|
|
Indexing to the specified remote index and download its IR binary file
|
|
|
|
|
|
|
|
|
|
|
|
#### Usage
|
|
|
|
|
|
1. Make the source code to a .jar file for your own project
|
|
|
|
|
|
|
|
|
|
|
|
2. Java API methods
|
|
|
|
|
|
|
|
|
|
|
|
Import classes:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`import net.irext.webapi.model.*;`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`import net.irext.webapi.WebAPIs;`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Get web API instance:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`WebAPIs webApis = WebAPIs.getInstance();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Sign in for access id and token:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`Admin admin = webApis.signIn(userName, password);`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`int id = admin.getId();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`int token = admin.getToken();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Fetch categories of household appliances:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<Category> categories = webApis.listCategories();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Fetch brands for an certain category (other than STB):
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<Brand> brands = webApis.listBrands();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Fetch cities (in China) for STB:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<City> provinces = webApis.listProvinces();`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<City> cities = webApis.listCities(provincePrefix);`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Fetch STB operators of a certain city:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<StbOperator> operators = webApis.listOperators(cityCode);`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Fetch remote indexes of certain brand or STB operator:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`List<RemoteIndex> remoteIndexes = webApis.listRemoteIndexes(categoryID, brandID, cityCode, operatorID);`
|
2017-04-25 19:27:54 +08:00
|
|
|
|
|
|
|
|
|
|
Download IR binary for certain remote index:
|
|
|
|
|
|
|
2017-04-25 19:30:51 +08:00
|
|
|
|
`InputStream is = webApis.downloadBin(remoteIndex.getRemote_map(), remoteIndex.getId());`
|