Closed EmilTemirov closed 9 years ago
I think the documentation is just confusing here. If a response exists for 2014 called "response123" and you create a response for 2015 called "response123" they will automatically be associated with the same company_fund_id and there is no way to pass company_fund_id directly.
This should not be a concern for an API consumer since the relationship between responses and company funds is curated by the respondent in collaboration with GRESB and can be changed after the fact.
Further, We expect the list of responses returned by /api/responses will be pre-populated with empty responses for 2015 for any respondents who participated in 2014.
Does that make sense?
So, how can I update any existing response via API? For example, I create new response with a wrong country value
curl -H 'Authorization: Bearer YOUR_TOKEN_HERE' -H "Content-Type: application/json" -d
'{"survey_date": 2015, "name": "responseTest4", "manager": "Emil", "country": "UA" }'
https://api-sandbox.gresb.com/api/responses
and then I want to get rid of this mistake, change country to "GB".
Hi @EmilTemirov i see now the update response API call is entirely missing from the documentation!. Sorry about that. I'm adding it in now but it looks like so:
PUT /api/responses/:id
$ curl -X PUT -d name='New Name' -d manager='New Manager' https://api.gresb.com/api/responses/123 \
-H 'Authorization: Bearer ...' \
The 123
ID is the the one returned but the create response POST /api/responses
call or the one listed in GET /api/responses
It is not company_fund_id
which is a foreign key to the 'CompanyFund' model which is not yet exposed in the API. This model simply links responses for the same company or fund over multiple survey years.
Updated documentation now includes the missing 'Update Response' section: http://localhost:4567/#update-response. Let me know if you have further issues
From documentation:
When I try to send request with existing name and manager I get error:
How to reproduce:
1) First, send request to create new GRESB response:
2) Send request with the same name and manager values:
I tried some of sensible variations: 1) I sent POST request with the response_id as a parameter Response - same error as before. 2) I sent PUT request with/without the response_id Response:
What am I doing wrong?