HTTP
Nubison IoT HTTP νμ€ κ·κ²©μ λλ€.
Nubison IoT νλ«νΌμ HTTPλ₯Ό ν΅ν΄ λ°μ΄ν°λ₯Ό μ μ‘νλ λλ°μ΄μ€λ₯Ό μ°κ²°νκΈ° μν κ°μ΄λμ λλ€.
μλ κ³Όμ μ μ§ννκΈ° μ μ, μμνκΈ°μ μ ν κ³Όμ λ€μ΄ λ°λμ μ νλμ΄μΌ ν©λλ€.
μλ² μ°κ²°
Nubison IoT νλ«νΌμ HTTPλ‘ μ°κ²°νκΈ° μν μ 보μ λλ€.
μλ² URL: μ°λ μ§νμ μλ΄
λλ°μ΄μ€ λ‘κ·ΈμΈ
Nubison IoT νλ«νΌμ λλ°μ΄μ€λ₯Ό λ‘κ·ΈμΈν©λλ€.
λ€λ₯Έ μμ²μ μ§ννκΈ° μ μ λ‘κ·ΈμΈμ λ°λμ μ§νν΄μΌ ν©λλ€.
λ‘κ·ΈμΈ μμ² μλ΅μΌλ‘ λμμ€λ μ‘μΈμ€ ν ν°μ μ΄μ©νμ¬ λ€λ₯Έ μμ²λ€μ λ³΄λΌ μ μμ΅λλ€.
λν Nubison IoT νλ«νΌ μΉμμ νμλΌμΈμ βν΄λΌμ°λ μ μβμ΄ κΈ°λ‘λ©λλ€.
POST /devices/login
[Request]
Content-Type: application/x-www-form-urlencoded
<Header>
Authorization
O
Basic <${ν΄λΌμ΄μΈνΈ ID}:${ν΄λΌμ΄μΈνΈ Secret}μ base64 μΈμ½λ©ν μ€νΈλ§>
ex.
ν΄λΌμ΄μΈνΈ ID = AbCdE123, ν΄λΌμ΄μΈνΈ Secret = xyzabc123 μ΄λΌκ³ νλ©΄,
Basic AbCdE123:xyzabc123
μ¬κΈ°μμ AbCdE123:xyzabc123λ₯Ό Base64 μΈμ½λ©
(Basic QmFzaWMgQWJDZEUxMjM6eHl6YWJjMTIz)μ 보λ΄μ£Όμ
μΌ ν©λλ€.
<Body>
deviceKey
O
λλ°μ΄μ€ ν€
[Response] Content-Type: application/json
status
message
body
200
OK
{
"AccessToken" : "...."
}
400
Bad Request
{
"code" :"ERROR401",
"message": "authorization header does not exist."
}
{
"code" :"ERROR402",
"message": "deviceKey is missing."
}
{
"code" :"ERROR403",
"message": "client is not valid."
}
405
Not Found
// μλΉμ€κ° μ‘΄μ¬νμ§ μλ κ²½μ°
415
Invalid content-type
// content-type must be application/json
λλ°μ΄μ€ λ‘κ·Έμμ
NUBISON IoT νλ«νΌμμ λλ°μ΄μ€κ° λ‘κ·Έμμν©λλ€.
μ¬μ©νλ ν ν°μ΄ λ§μλλ©°, Nubison IoT νλ«νΌ μΉμμ νμλΌμΈμ ν΄λΌμ°λ μ μν΄μ κ° κΈ°λ‘λ©λλ€.
POST /devices/logout
[Request]
Content-Type: application/json
<Body>
accessToken
O
NUBISON IoT νλ«νΌ λ‘κ·ΈμΈ μ μλ²λ‘λΆν° λ°μ μ κ·Ό ν ν°
deviceKey
O
λλ°μ΄μ€ ν€
μμ
[Response] Content-Type: application/json
status
message
body
200
OK
// μλ²μμ λ‘κ·ΈμΈ μ λ°κΈν access tokenμ μμ ν©λλ€.
400
Bad Request
{
"code" :"ERROR402",
"message": "deviceKey is missing."
}
{
"code" :"ERROR404",
"message": "accessToken is missing."
}
401
Unauthorized
// accessToken is not valid.
405
Not Found
service is not found. or device is not registered.
415
Invalid content-type
// content-type must be application/json
λ°μ΄ν° μ μ‘
Nubison IoT νλ«νΌμ λλ°μ΄μ€ λ°μ΄ν°λ₯Ό μ μ‘ν©λλ€.
POST /devices/data
[Request] Content-Type: application/json
<Body>
accessToken
O
λ‘κ·ΈμΈ μ μλ²λ‘λΆν° λ°μ μ κ·Ό ν ν°
deviceKey
O
λλ°μ΄μ€ ν€
data
O
λλ°μ΄μ€ λ°μ΄ν°
[Response] Content-Type: application/json
status
message
body
201
Created
400
Bad Request
{
"code" :"ERROR402",
"message": "deviceKey is missing."
}
{
"code" :"ERROR404",
"message": "accessToken is missing."
}
{
"code" :"ERROR406",
"message": "data is missing."
}
401
Unauthorized
// accessToken is not valid.
415
Invalid content-type
// content-type must be application/json
μλ λλΌμ΄λ² μ΄μ© μ κΈ°λ³Έ νμ΄λ‘λ κ·κ²©
Nubison IoT νλ«νΌμμ μλ μμ±λ λλΌμ΄λ²λ₯Ό μ΄μ©νλ κ²½μ° Bodyμ data κ°μ λ€μκ³Ό κ°μ΄ 보λ΄μ£Όμλ©΄ λλ°μ΄μ€κ° λ³΄λΈ λ°μ΄ν°λ₯Ό Nubison IoT νλ«νΌμ μ μ₯ν μ μμ΅λλ€.
μλλλΌμ΄λ²λ₯Ό μ΄μ©νμλ κ²½μ° λ€μκ³Ό κ°μ΄ λ°μ΄ν°λ₯Ό ꡬμ±νμλ©΄ λ©λλ€.
request body json κ° μ€μμ, "data" key νμμ, "μ λλ²νΈ"λ₯Ό keyλ‘ νκ³ "μ λ κ°"μ value λ‘ νλ json κ°μ²΄λ₯Ό ꡬμ±νμ¬ λ°μ΄ν°λ₯Ό μ μ‘ν©λλ€. (μλ μμ±λ λλΌμ΄λ²λ₯Ό μ΄μ©νλ κ²½μ°, λλ°μ΄μ€κ° λ³΄λΈ λ°μ΄ν°λ₯Ό Nubison IoT νλ«νΌ μλ²μμ μ λλ²νΈ κΈ°μ€μΌλ‘ λ°μ΄ν°λ₯Ό ꡬλΆνμ¬ ν΄λΉ μ λ λ²νΈμ κ°μΌλ‘ λ°μ΄ν°λ₯Ό μ μ₯νκ² λ©λλ€.)
μ«μ, μμΉ λ°μ΄ν°λ μ«μ ν¬λ§·μΌλ‘,
λ¬Έμ λ°μ΄ν°λ λ¬Έμ ν¬λ§·μΌλ‘,
μ«μ λ°°μ΄ λ°μ΄ν°λ μ«μ λ°°μ΄ ν¬λ§·μΌλ‘,
λ¬Έμ λ°°μ΄ λ°μ΄ν°λ λ¬Έμ λ°°μ΄ ν¬λ§·μΌλ‘,
μ΄λ―Έμ§λ base64λ‘ μΈμ½λ©ν μ€νΈλ§
λ°μ΄ν°λ₯Ό λ€μκ³Ό κ°μ΄ 보λΈλ€λ©΄
νμ΄λ‘λλ₯Ό λ€μκ³Ό κ°μ΄ ꡬμ±ν΄μ£Όμλ©΄ λ©λλ€.
Last updated
Was this helpful?