Professional Documents
Culture Documents
Version: 1.1
2011 05
API ..........................................................................................................1
1. ...................................................................................................................................3
2. ...................................................................................................................................4
2.1 ...................................................................................................................................4
2.2 ............................................................................................................................4
3. ...........................................................................................................................................4
3.1 ............................................................................................................................4
4. API ....................................................................................................................................4
4.1. ......................................................................................................................4
4.1.1.
login.................................................................................................................4
4.1.2.
test...................................................................................................................6
4.2. ..............................................................................................................7
4.2.1.
.................................................................................................................7
4.2.2.
.................................................................................................................9
4.3. ....................................................................................................................11
4.3.1.
...............................................................................................................11
4.4. ....................................................................................................................13
4.4.1.
...............................................................................................13
4.5. ....................................................................................................15
4.5.1.
...............................................................................................15
4.5.2.
...............................................................................17
4.5.3.
.......................................................................................................18
4.5.4.
...............................................................................................19
4.6. ....................................................................................................................20
4.6.1.
.......................................................................................................20
1
1.
OSS/BS
SS
2004
2005
2.
2.1
API
API
2.2
3.
API
3.1
API
4. API
4.1.
4.1.1. login
sessionid,
URL
http://hostserver:9002/api/client/login
JSON
HTTP
GET
httphead
appkey
true
string
appkey,
,
HmacSHA1
timestamp nonce&
signature
true
string
login
+login
timestamp
true
long
nonce
true
string
httphead login
+login
abc123456login
hmacSHA1(12312312421312321+&+ 12324abc123456)
hmacSHA1HmacSHA1
HTTP400Bad request
403(Forbidden)JSON
{
"serverDate" : "2011-7-26 14:44:57",
"sessionId" : "f4d00e26-d4dc-4a40-9e34-a1124d313e07",
"accessSecret" : "13eab32e-bb2e-4933-833b-f506631497d0",
"updateCode" : 1,
"updateDescription" : ""
}
serverDate
sessionId Httphead
accessSecret + accessSecret
updateCode 012
updateDescription
4.1.2. test
login,
URL
http://hostserver:9002/api/client/test
JSON
HTTP
GET
signature
true
string
HmacSHA1
timestamp nonce&
login
+login
,
timestamp
true
long
nonce
true
string
sessionid
true
string
login sessionid
abc123456login
accessSecret13eab32e-bb2e-4933-833b-f506631497d0
hmacSHA1(timestamp +&+ nonce abc123456+
13eab32e-bb2e-4933-833b-f506631497d0)
hmacSHA1HmacSHA1
403Forbidden:HTTP403login
sessionid
4.2.
4.2.1.
URL
http://nlctest.hostserver.com/api/ subjects
JSON
HTTP
GET
Subject
+
subject
true
string
home,
recommend
home+recommend
category
false
string
lastUpdateT
false
string
ime
start-index
false
integer
max-result
false
integer
10
lastUpdateTimeHTTP304
http://nlctest.hostserver.com/api
/subjects/subject=home+recommend?lastUpdateTime=131125271000
HTTP304JSON
{
"items" : [{
"id" : 1234,
"title" : "",
"icon" : "/upload/fenluxiaoniao.png",
"price" : 12
},
{
"id" : 1235,
"title" : "",
"icon" : "/upload/shuiguo.png",
"price" : 1
}
],
"lastUpdateTime" : "1312790591578",
"totalResult" : 2
}
lastUpdateTime:
totalResult: max-result
max-result
4.2.2.
URL
http://nlctest.hostserver.com/api/category
JSON
HTTP
GET
category
true
string
lastUpdateT
false
string
ime
start-index
false
integer
max-result
false
integer
10
sort
false
string
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api /category/category=game?lastUpdateTime=131125271000
HTTP304JSON
{
"items" : [{
"id" : 1234,
"title" : "",
"icon" : "/upload/fenluxiaoniao.png",
"price" : 12
},
{
"id" : 1235,
"title" : "",
"icon" : "/upload/shuiguo.png",
"price" : 1
}
],
"lastUpdateTime" : "1312790591578",
"totalResult" : 2
}
lastUpdateTime:
totalResult:max-result
max-result
4.3.
4.3.1.
URL
http://nlctest.hostserver.com/api/search
JSON
HTTP
GET
keyword
true
string
category
false
string
start-index
false
integer
max-result
false
integer
10
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api /search?keyword=
HTTP304JSON
{
"items" : [{
"id" : 1234,
"title" : "",
"icon" : "/upload/fenluxiaoniao.png",
"price" : 12
},
{
"id" : 1235,
"title" : "",
"icon" : "/upload/shuiguo.png",
"price" : 1
}
],
"lastUpdateTime" : "1312790591578",
"totalResult" : 2
lastUpdateTime:
totalResult:max-result
max-result
4.4.
4.4.1.
URL
http://nlctest.hostserver.com/api/ hot
JSON
HTTP
GET
false
string
false
Integer
catego
,
ry
1 2
sort
type
false
integer
0 1 2
false
integer
false
integer
10
start-in
dex
max-re
sult
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api /top
HTTP304JSON
{
"items" : [{
"id" : 1234,
"title" : "",
"icon" : "/upload/fenluxiaoniao.png",
"price" : 12
},
{
"id" : 1235,
"title" : "",
"icon" : "/upload/shuiguo.png",
"price" : 1
}
],
"lastUpdateTime" : "1312790591578",
"totalResult" : 2
}
lastUpdateTime:
totalResult:max-result
max-result
4.5.
4.5.1.
id
URL
http://nlctest.hostserver.com/api/ product/{:id}
JSON
HTTP
GET
id
true
string
lastUpd
fals
id
string
ateTime
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api /product/1234?lastUpdateTime=131125271000
HTTP304JSON
{
"id" : 1234,
"title" : "",
"icon" : "/upload/fenluxiaoniao.png",
"price" : 12,
"author" : "",
"updateTime" : "",
"keyword" : "",
"description" : "Angry Birds()
"
}
lastUpdateTime:
Title:
Price:
Author:
updateTime:
Keyword:
Description:
Icon:
4.5.2.
id
URL
http://nlctest.hostserver.com/api/ productphone
JSON
HTTP
GET
id
true
string
id
brand
false
string
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api /productphone/id=1234?lastUpdateTime=131125271000
HTTP304JSON
[
{
"title" : "htc",
"value" : "htc"
},
{
"title" : "",
"value" : "motoluola"
Title:
value:
4.5.3.
id
URL
http://nlctest.hostserver.com/api/ product/download
JSON
HTTP
GET
id
true
string
id
phone
true
string
lastUpdateTimeHTTP
304
http://nlctest.hostserver.com/api
/product/download?id=1234&phone=12345&lastUpdateTime=131125271000
4.5.4.
URL
http://nlctest.hostserver.com/market/getDownloadUrl
JSON
HTTP
GET
Appid
true
string
ID
Acctid
true
string
ID
Msisdn
true
string
Brand
false
string
PhoneModel
false
string
OS
false
string
Resolution_width
false
integer
Resolution_height
false
integer
Keyid
true
string
()
Keyid300
000
http://nlctest.hostserver.com/market/getDownloadUrl?Appid=126&Acctid=13988
881123&MSISDN=13988881123&Keyid=6784239422983
{
"downloadUrl":"http://nlctest.hostserver.com/upload/test/Aiji
a.apk",
"code":0
}
code -
4.6.
4.6.1.
id
URL
http://nlctest.hostserver.com/market/sendSms
JSON
HTTP
GET
to
true
string
msg
true
string
http://nlctest.hostserver.com/market/sendSMS?to=15901271390&msg=helloworld
{
"code":0,
"msg":""
}
code 0
msg