Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. step 1:
  2. run service with 1 parameter AUTHORIZATION_CODE
  3.  
  4. step 2:
  5. POST login.teithe.gr/token
  6. headers:
  7. Content-Type: application/x-www-form-urlencoded
  8. body:
  9. client_id: MY_CLIENT_ID
  10. client_secret: MY_CLIENT_SECRET
  11. grant_type:authorization_code
  12. code: MY_AUTHORIZATION_CODE
  13.  
  14. request success
  15. - store REFRESH_TOKEN
  16. - store ACCESS_TOKEN
  17. request failed
  18. possible email for notification and kill service
  19.  
  20. step 3:
  21. create methods
  22. - refresh token
  23. POST login.teithe.gr/token
  24. headers:
  25. Content-Type: application/x-www-form-urlencoded
  26. body:
  27. client_id: MY_CLIENT_ID
  28. client_secret: MY_CLIENT_SECRET
  29. grant_type:refresh_token
  30. code: REFRESH_TOKEN
  31.  
  32. request success
  33. - store REFRESH_TOKEN
  34. - store ACCESS_TOKEN
  35. request failed
  36. possible email for notification and kill service
  37.  
  38. - load announcments
  39. GET api.it.teithe.gr/announcements
  40. headers:
  41. x-access-token: ACCESS_TOKEN
  42. Content-Type:application/json
  43.  
  44. request success
  45. - if previews list size < new list
  46. find new announcments
  47. send notification
  48. override list with new list
  49. request failed
  50. if code 401
  51. possible email for notification and kill service
  52. else
  53. ignore
  54.  
  55. - send notification(id, about, category, name, title)
  56. post firebase service
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement