- Add Android Device
- Logout Android Device
- Remove Android Device
- Get Unread Notifications
- Set Notifications as Read
- Set a Notification as Read
- Fetch Notification Config Settings
- Set Notification Config Settings
- Android Notifications Data Examples
Add user's Android device to receive notifications.
- Use
POST
http method - Requires authentication
reg_id
(required). Registration ID of the device.model
(optional). Device model.manufacturer
(optional). Device manufacturer.product_name
(optional). Device product name.
curl -u 204254:Sy7PRGGr4foUk22uzjMu "https://api.bukalapak.com/v1/notifications/android.json" -X POST --data "reg_id=ASD223SDA&model=GG-P4124H&manufacturer=Nokia&name=Lumpia"
Success response:
{
"status":"OK",
"message":"Device added"
}
Failed response:
{
"status":"ERROR",
"message":"Failed adding device"
}
Logout current user from current device.
- Use
DELETE
http method - Requires authentication
reg_id
(required). Registration ID of the device.
curl -u 204254:Sy7PRGGr4foUk22uzjMu "https://api.bukalapak.com/v1/notifications/logout.json" -X DELETE --data "reg_id=ASD223SDA"
Success response:
{
"status":"OK",
"message":"Device logged out"
}
Failed response:
{
"status":"ERROR",
"message":"Failed logging out"
}
Remove user's Android device from receiver devices list.
- Use
DELETE
http method - Requires authentication
reg_id
(required). Registration ID of the device.
curl -u 204254:Sy7PRGGr4foUk22uzjMu "https://api.bukalapak.com/v1/notifications/android.json" -X DELETE --data "reg_id=ASD223SDA"
Success response:
{
"status":"OK",
"message":"Device unregistered"
}
Failed response:
{
"status":"ERROR",
"message":"The requested device doesn't belong to this user"
}
Get numbers of unread messages and transactions.
- Requires authentication
reg_id
(required). Registration ID of the device.
curl -u 204254:Sy7PRGGr4foUk22uzjMu "https://api.bukalapak.com/v1/notifications/unreads.json"
{
"messages":0,
"transactions_need_action_as_seller":0,
"transactions_as_buyer":0,
"unread_notifications":0,
"transactions_need_action_as_buyer":4
}
- Use
PUT
http method - Requires authentication
reg_id
(required). Registration ID of the device.
curl -u 204254:Sy7PRGGr4foUk22uzjMu -X PUT "https://api.bukalapak.com/v1/notifications.json" --data ""
{
"status":"OK",
"message":null
}
- Use
PUT
http method - Requires authentication
notification_transaction_id
(required). Notification ID of the transaction.
curl -u 204254:Sy7PRGGr4foUk22uzjMu -X PUT "http://api.local.host:3000/v1/notifications/52a6e5e284eab03aa200013a.json"
Success response
{
"status":"OK",
"unread":0,
"message":null
}
Failed response
{
"status":"ERROR",
"unread":1,
"message":"The requested notifications doesn't belong to the current user"
}
- Use
GET
http method - Requires authentication
reg_id
(required). Device registration ID.
curl -u 204254:Sy7PRGGr4foUk22uzjMu https://api.bukalapak.com/v1/notifications/config.json?reg_id=BD12A34
Success response
{
"status":"OK",
"config":{
"transaction":1,
"nego":1,
"message":1,
"report":1
},
"message":null
}
Failed response
{
"status":"ERROR",
"config":null,
"message":"Failed Fetching Device Configuration"
}
- Use
PUT
http method - Requires authentication
reg_id
(required). Device registration ID.config
(required). Configuration hash values. At least one must be present. Value1
if on, value0
if off.config[transaction]
(optional). Transaction push notification.config[message]
(optional). Message push notification.config[nego]
(optional). Offer push notification.config[report]
(optional). Report push notification.
curl -u 204254:Sy7PRGGr4foUk22uzjMu -X PUT "https://api.bukalapak.com/v1/notifications/config.json" --data "reg_id=BDNAEASM&config[transaction]=1&config[message]=0"
Success response
{
"status":"OK",
"message":"Configuration Updated"
}
Failed response
{
"status":"ERROR",
"message":"Failed Updating Configuration"
}
Transaction Notification
{
"type"=>"transaction",
"receiver_id"=>204254,
"message"=>"Transaksi baru dari Liem Lie Wie",
"details"=>{
"id"=>51960,
"state"=>"paid",
"transaction_id"=>"131211141960",
"amount"=>155000,
"quantity"=>1,
"shipping_fee"=>8000,
"total_amount"=>163000,
"products"=>[1069398],
"consignee"=>{
"name"=>"Me Ow",
"address"=>"Jl Lancar XXI",
"city"=>"Jakarta Barat",
"province"=>"DKI Jakarta",
"post_code"=>"11440"
},
"buyer"=>{
"id"=>15,
"name"=>"Me Ow",
"username"=>"meow"
},
"seller"=>{
"id"=>204254,
"name"=>"Testing Account",
"username"=>"testingaccount"
},
"actions"=>["deliver", "reject"],
"created_at"=>"2013-12-11T14:59:21+07:00"
}
}
Offer Notification
{
"data"=>{
"type"=>"nego",
"receiver_id"=>204254,
"message"=>"Anda mendapatkan tawaran nego dari Me Ow",
"details"=>{
"id"=>51588,
"state"=>"waiting",
"amount"=>100,
"quantity"=>1,
"product"=>{
"id"=>1069403,
"name"=>"Bantal bibir pink Impor",
"normal_price"=>70000
},
"actions"=>["accept", "reject"],
"buyer"=>{
"id"=>15,
"name"=>"Me Ow",
"username"=>"meow"
},
"seller"=>{
"id"=>204254,
"name"=>"Testing Account",
"username"=>"testingaccount"
}
}
}
}
Message Notification
{
"data"=>{
"type"=>"message",
"receiver_id"=>204254,
"message"=>"Anda mendapatkan pesan dari Me Ow"
"details"=>{
"id":"56be34322",
"inbox_id":"56be34",
"message"=>"mantab gan"
}
}
}
Report Notification
{
"data"=>{
"type"=>"report",
"receiver_id"=>204254,
"message"=>"g.kunci sinchan telah dilaporkan",
"details"=>nil
}
}
Reminder (Only Received Right After Logging in via App)
{
"data"=>{
"type"=>"reminder",
"unread_notifications"=>17,
"messages"=>0,
"transactions_need_action_as_seller"=>12,
"transactions_need_action_as_buyer"=>3,
"offers_need_action_as_seller"=>1,
"offers_need_action_as_buyer"=>0
}
}