| # Copyright 2014 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| A simple web service used by Buffet to test interactions with a |
| device server. Implements basic functionality for registration, device commands |
| and state changes. |
| |
| To start the test server yourself, run server.py. Otherwise, server.py exposes |
| start_server/stop_server methods. |
| |
| To test locally: |
| ./server.py |
| |
| # Register a device. |
| curl -X POST -d "" http://localhost:8080/buffet/registrationTickets |
| curl -X PATCH -d '{"userEmail": "me"}' -H "Authorization: Bearer 1/TEST-ME" \ |
| http://localhost:8080/buffet/registrationTickets/<id> |
| curl -X POST -d "" \ |
| http://localhost:8080/buffet/registrationTickets/<id>/finalize |
| |
| # List devices |
| curl -X GET -d "" http://localhost:8080/buffet/devices |
| |
| # Send your device a command. |
| curl -X POST -d '{"base": { "Reboot": {}}' http://localhost:8080/buffet/devices\ |
| ?deviceId=<device_id> |
| |
| # Update the status of your command |
| curl -X PATCH -d '{"state": "done"}' http://localhost:8080/buffet/devices/\ |
| <command_id> |