240 likes | 364 Vues
TRANSPORTS 22. An easy way to serve orders. INDEX. INTRODUCTION API MOTIVATION GUI. 1 INTRODUCTION. TOPIC: TRANSPORTS COMPANY API URL - http://group22aiss.appspot.com/api/ API DOC URL - http://group22aiss.appspot.com AUTHORS Alberto Rincón Borreguero - arincon1992@gmail.com
E N D
TRANSPORTS 22 An easy way to serve orders
INDEX • INTRODUCTION • API • MOTIVATION • GUI
1 INTRODUCTION • TOPIC: TRANSPORTS COMPANY • API URL - http://group22aiss.appspot.com/api/ • API DOC URL - http://group22aiss.appspot.com • AUTHORS • Alberto Rincón Borreguero - arincon1992@gmail.com • Rafael Vázquez Sánchez - rafa.vazsan@gmail.com • Francisco García Moreno - fragarmor@alum.us.es
Driver: { "surname": "Baskes", "name": "Raphael", "id": 1 } 2 API - RESOURCES Order: { "destinationAddress": "Akresh 8", "sourceAddress": "Aluham, 14", "refNumber": 7, "driverID": 0, "productType": "coffee", "productQuantity": 20, "status": "PENDING" }
2 API - METHODS (Auth) Logging in: • GET - /auth • Parameters (header): • username: <the user's name here> • password: <the user's password here> • Response: • The user's auth token • E.g.: PPRUD8844200LK3J4JGB22MI444JN1R
2 API - METHODS (Orders) Create a new order: • POST - /orders/ • Request: { "destinationAddress": "Sevilla", "sourceAddress": "Marrakech", "productType": "drink", "productQuantity": 1000, "driverID": 0, "refNumber": 0, "status": "PENDING" }
2 API - METHODS (Orders) Show a single order: • GET - /orders/{refNumber} • Response: { "destinationAddress": "Akresh 8", "sourceAddress": "Aluham, 14", "refNumber": 7, "driverID": 0, "productType": "coffee", "productQuantity": 20, "status": "PENDING“ }
2 API - METHODS (Orders) List all orders: • GET - /orders/ • Response: [{ "destinationAddress": "Akresh 8", "sourceAddress": "Aluham, 14", "refNumber": 7, "driverID": 0, "productType": "coffee", "productQuantity": 20, "status": "PENDING" }, { "destinationAddress": "Alame, 7", "sourceAddress": "Hamkinel, 23", "refNumber": 8, "driverID": 0, "productType": "fruit", "productQuantity": 20, "status": "PENDING" }]
2 API - METHODS (Orders) Update an existing order: *auth required (driver/admin) • PUT - /orders/{refNumber} • Request: { "destinationAddress": "Sevilla", "sourceAddress": "Marrakech", "productType": "drink", "productQuantity": 1000, "driverID": 2, <-- admin only "refNumber": 5, "status": "SHIPPED“ <-- driver only }
2 API - METHODS (Drivers) Show a single driver: *auth required (driver/admin) • GET - /drivers/{driverID} • Response: { "surname": "Baskes", "name": "Rafa", "id": 1 }
2 API - METHODS (Drivers) List all drivers: *auth required (admin) • GET - /drivers/ • Response: [{ "surname": "Baskes", "name": "Rafa", "id": 1 }, { "surname": "Garmo", "name": "Fran", "id": 2 }, { "surname": "Rinco", "name": "Albertitou", "id": 3 }]
2 API - METHODS (Drivers) List orders assigned to a driver: *auth required (driver) • GET - /drivers/{driverID}/orders/ • Response: [{ "destinationAddress": "Alame, 7", "sourceAddress": "Hamkinel, 23", "refNumber": 8, "driverID": 1, "productType": "fruit", "productQuantity": 20, "status": "PENDING" }, { "destinationAddress": "Krantiun, 8", "sourceAddress": "khonkraniu, 9", "refNumber": 18, "driverID": 3, "productType": "fish", "productQuantity": 20, "status": "PENDING" }]
3 MOTIVATION WHY TO USE OUR API? SECURITY:LOG IN TO MANAGE ADVANCED OPTIONS PERSISTENCE:HAVE ALWAYS YOUR DATA AVAILABLE IMPLEMENTATION: VERY EASY TO IMPLEMENT WITH A GREAT DOCUMENTATION
That’sit THE END