Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API request to add "place" to a drop does not work #51

Open
dan-king opened this issue Jul 2, 2013 · 0 comments
Open

API request to add "place" to a drop does not work #51

dan-king opened this issue Jul 2, 2013 · 0 comments
Assignees
Labels

Comments

@dan-king
Copy link

dan-king commented Jul 2, 2013

The API request to add a "place" to a drop is broken. In some cases a response is returned that indicates it succeeded.

But after each attempt I am no longer able to get any drops from the given river or bucket. I must first remove the place before the given river/bucket's drops can be viewed again.

I'm trying to use the API to add places to drops as documented:

https://wiki.ushahidi.com/display/WIKI/SwiftRiver+API+Drop+Resources#SwiftRiverAPIDropResources-post-drops-id-places



Attempt # 1



INPUT TO API:

request_path: /buckets/300/drops/149920/places
request_parameters: { "name":"Tacoma", "type":"point", "coordinates":[ [ -122.5161, 47.302 ] ] }
request_method: POST
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )

RESPONSE FROM API:

{"id":283451,"type":null,"longitude":0,"latitude":0,"name":"Tacoma"}

RESULT:
Can no longer retrieve any drops from the bucket. Have to remove the place before I can see the drops again.

request_path: /buckets/300/drops/149920/places/283451
request_parameters:
request_method: DELETE
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )



Attempt # 2



Tried again using lon/lat parameters

INPUT TO API:

request_path: /buckets/300/drops/149920/places
request_parameters: { "longitude": -122.5069, "latitude": 47.2994, "type":"point", "name":"Ruston" }
request_method: POST
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )

RESPONSE FROM API:

{"id":283452,"type":null,"longitude":-122.5069,"latitude":47.2994,"name":"Ruston"}

RESULT:
Same result. Can no longer retrieve any drops from the bucket. Have to remove the place before I can see the drops again.

request_path: /buckets/300/drops/149920/places/283452
request_parameters:
request_method: DELETE
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )



Attempt # 3



Tried again using quotes around the lon/lat values:

INPUT TO API:
request_path: /buckets/300/drops/149920/places
request_parameters: { "longitude": "-122.5069", "latitude": "47.2994", "type":"point", "name":"Ruston" }
request_method: POST
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )

RESPONSE FROM API:
Fatal error: Uncaught exception 'Exception' with message 'An error occurred: array ( 'message' => 'Drop 149920 already has the place Ruston with coordinates [47.299400, -122.507004]', )' in /opt/firsttosee/swift/api2.php:232 Stack trace: #0 /opt/firsttosee/swift/api2.php(249): API_Client->exec_api_request('/buckets/300/dr...', '{??"longitude":...', 'POST', Array) #1 {main} thrown in /opt/firsttosee/swift/api2.php on line 232

Note that I had already removed the place from the drop in order to restore the bucket. So why did I get the error that it already has this place?



Attempt # 4



Tried one last time with quotes around lon/lat values. I rounded the numbers to avoid the duplication error from Attempt #3.

INPUT TO API:

request_path: /buckets/300/drops/149920/places
request_parameters: { "longitude": "-122.507", "latitude": "47.299", "type":"point", "name":"Ruston" }
request_method: POST
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )

RESPONSE FROM API:

{"id":283453,"type":null,"longitude":-122.507,"latitude":47.299,"name":"Ruston"}

RESULT:
Same problem: I can no longer retrieve any drops from the bucket. Have to remove the place before I can see the drops again.

request_path: /buckets/300/drops/149920/places/283453
request_parameters:
request_method: DELETE
request_headers: Array ( [Content-Type] => application/json [Accept] => application/json )

@ghost ghost assigned ekala Jul 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants