AFFORDMED ® Technology, Innovation &Af ordability Request (POST) http://20.244.56.144/test/register { "companyName": "goMart", "ownerName": "Rahul", "rollNo": "1", "ownerEmail": "
[email protected]", "accessCode": "FKDLjg" } Response You can register only once and cannot get the credentials again. DON’T FORGET TO SAVE THIS! { "companyName": "goMart", "clientID": "37bb493c-73d3-47ea-8675-21f66ef9b735", "clientSecret": "HVIQBVbqmTGEmaED", "ownerName": "Rahul", "ownerEmail": "
[email protected]", "rollNo": "1", } Authorisation Token This is an API to obtain the Authorisation Token for your company Request (POST) http://20.244.56.144/test/auth { "companyName": "goMart", "clientID": "37bb493c-73d3-47ea-8675-21f66ef9b735", "clientSecret": "XOyolORPasKWOdAN", "ownerName": "Rahul", "ownerEmail": "
[email protected]", "rollNo": "1" } Response Expected: (Status Code: 200) { "token_type": "Bearer", Afford Medical Technologies Private Limited B 230 2nd Main Road, Sainikpuri, Hyderabad-500094, Telangana, INDIA. Phone: 91-40-27117068/27116133, Web: www.affordmed.com, E-mail:
[email protected], CIN: U72200TG2007PTC056067, URN: UDYAM-TS-20-0013532
AFFORDMED ® Technology, Innovation &Af ordability "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJNYXBDbGFpbXMiOnsiZXhwIjoxNzEwODM1MjY4LCJpYXQiOjE3MTA4M zQ5NjgsImlzcyI6IkFmZm9yZG1lZCIsImp0aSI6IjM3YmI0OTNjLTczZDMtNDdlYS04Njc1LTIxZjY2ZWY5YjczNSIsInN1 YiI6InJhaHVsQGFiYy5lZHUifSwiY29tcGFueU5hbWUiOiJnb01hcnQiLCJjbGllbnRJRCI6IjM3YmI0OTNjLTczZDMtNDd lYS04Njc1LTIxZjY2ZWY5YjczNSIsImNsaWVudFNlY3JldCI6IkhWSVFCVmJxbVRHRW1hRUQiLCJvd25lck5hbWUiOiJSYW h1bCIsIm93bmVyRW1haWwiOiJyYWh1bEBhYmMuZWR1Iiwicm9sbE5vIjoiMSJ9.gmk2F73GZ7q7EaIGDShc4oDKK1zWQ9Up 3xQ-4Dbsu8A", "expires_in": 1710835268 } Develop Average Calculator HTTP Microservice Create an Average Calculator microservice that exposes a REST API "numbers/{numberid}" that exclusively accepts qualified number IDs. ● Qualified IDs include 'p' for prime, 'f' for Fibonacci, 'e' for even, and 'r' for random numbers. ● Configure a window size, e.g., 10. ● Upon each request, fetch numbers from a third-party server and store them. Avoid implementing APIs for generating even, prime, etc., numbers; solely rely on the provided Test Server API. ● Ensure stored numbers are unique, disregarding duplicates. Ignore responses taking longer than 500 ms or encountering errors. ● If stored numbers are fewer than the window size, calculate their average. Limit stored numbers to the window size. Upon breaching the window size, replace the oldest number with the newest one. ● Respond to each request with the numbers stored before and after the latest API call, along with the average of numbers matching the window size. ● Maintain quick responses, never exceeding 500 milliseconds. Format response as follows: { "windowPrevState": [], "windowCurrState": [1, 3, 5, 7], "numbers": [1, 3, 5, 7], // response received from 3rd party server "avg": 4.00 } Test Case Assuming the window size to be set as 10 and your server running on localhost port 9876. Request http://localhost:9876/numbers/e Afford Medical Technologies Private Limited B 230 2nd Main Road, Sainikpuri, Hyderabad-500094, Telangana, INDIA. Phone: 91-40-27117068/27116133, Web: www.affordmed.com, E-mail:
[email protected], CIN: U72200TG2007PTC056067, URN: UDYAM-TS-20-0013532
AFFORDMED ® Technology, Innovation &Af ordability 1 st Response { "windowPrevState": [], "windowCurrState": [2, 4, 6, 8], "numbers": [2, 4, 6, 8], // response received from 3rd party server "avg": 5.00 } 2 nd Response { "windowPrevState": [2, 4, 6, 8], "windowCurrState": [12, 14, 16, 18, 20, 22, 24, 26, 28, 30], "numbers": [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30], "avg": 23.40 } Test Server APIs For your convenience, we are giving you a test server with the following APIs that returns numbers of a particular type - prime, fibonacci, even and random. Primes Request http://20.244.56.144/test/primes Response { "numbers": [2,3,5,7,11] } Fibonacci Request http://20.244.56.144/test/fibo Response { "numbers": [55,89,144,233,377,610,987,1597,2584,4181,6765] } Afford Medical Technologies Private Limited B 230 2nd Main Road, Sainikpuri, Hyderabad-500094, Telangana, INDIA. Phone: 91-40-27117068/27116133, Web: www.affordmed.com, E-mail:
[email protected], CIN: U72200TG2007PTC056067, URN: UDYAM-TS-20-0013532