.. _api-return-targets: Return Targets ============== The API call returns all targets of a given sensor. URL --- :: /api/v1/projects//nodes//sensors//targets/ Method ------ ``GET`` Request Fields -------------- The server returns targets in JSON or CSV format. Select output format by setting the accept header. ``Accept: application/json`` | ``Accept: text/csv`` Success Response ---------------- Requesting targets in JSON format: * **Request:** ``GET`` * **Request Fields:** ``Accept: application/json`` * **Code:** 200 OK * **Response Fields:** ``Content-Type: application/json`` * **Content:** :: [ "P100", "P101", "P102" ] Requesting targets in CSV format: * **Request:** ``GET`` * **Request Fields:** ``Accept: text/csv`` * **Code:** 200 OK * **Response Fields:** ``Content-Type: text/csv`` * **Content:** :: P100 P101 P102 Error Response -------------- No targets in database: * **Request:** ``GET`` * **Request Fields:** ``Accept: application/json`` * **Code:** 410 Gone * **Response Fields:** ``Content-Type: application/json`` * **Content:** ``{ "code": 410, "message": "No rows." }`` Sample Call ----------- cURL ^^^^ :: $ curl -X GET -u user:password -H "Accept: application/json" \ -G "http://localhost/api/v1/projects/0a5a2c9caa45405b9967584154ba1341/nodes/00ce160e5cbb49b9bc2ee6f243f87841/sensors/totalstation/targets/"