internship-team-ny / Planning

Keep all issues especially related to stories here
0 stars 0 forks source link

Develop REST API specs for Analytics service #18

Open asyoussef opened 7 years ago

asyoussef commented 7 years ago

(white box interface)

whamza15 commented 7 years ago

Since this piece is quite simple, I will make it more interesting to help you guys learn a few more things. Here are a few thoughts 1- This service should be made to accept calls from multiple web-servers (not only the one we are developing). i.e. it has a generic function that can be used by as many clients (web servers).

2- Each web server ( a client to the service) will have a some sort of authentication with the service (say a username and password). The service will deny any call not authenticated.

3- When the service receives /analyze call, it will return back a uniq ID to the caller with no further data. It will then do its business (get tweets, send them for analysis, etc.) then store results in the REDIS database under this uniq ID. This data should be made to expire in some time.

BONUS: 4- You can make the API call specify a call back url. If so, the service will CALL this url BACK when analysis is ready

Have fun! Ask me or @asyoussef if you need help in designing the API. But I think we should be able to write something like this during this sprint

asyoussef commented 7 years ago

http://swagger.io/ They claim to be "The World's Most Popular API Tooling". A lot of people use swagger to document their APIs.

whamza15 commented 7 years ago

Yes! I like it so much!

whamza15 commented 7 years ago

@AhmedYoussef95 Take a note of my proposal for using REDIS above

asyoussef commented 7 years ago

/analyze /results

whamza15 commented 7 years ago

To make this a serious service, calls to /analyze and results must use API credentials i.e. username and password similar to NLU and twitter services. You can use mongoDB or any DB to store these. For simplicity, username and password can be put manually in the DB. When the webserver (or any other approved caller) wants to make calls to the analytic service, it must uses the username and password in each call.

I suggest you use what is called Basic Authentication since it is the simplest @nashahzad when this is done, all your calls to the service will have to be done with basic authentication. As usual there are always node modules to help you make authenticated request and receive authenticated requests :)