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

index.delete_object() seems to require more authorization than it should #29

Closed
thibauld opened this issue Mar 17, 2016 · 3 comments
Closed

Comments

@thibauld
Copy link

I am trying to delete an object from my Algolia index in ruby.

Bot::Candidates.index.delete_object(candidate_id)

I get the following error:

Cannot DELETE to https://MYID.algolia.net/1/indexes/candidates/: {"message":"Method not allowed with this API key","status":403}

My API key has the following ACL:

search,addObject,deleteObject

When I try the same operation from the REST API, it works without a glitch:

curl -X DELETE -H "X-Algolia-API-Key: <sameapikeyasabove>" -H "X-Algolia-Application-Id: MYID" "https://MYID.algolia.net/1/indexes/candidates/<objectID>"

after checking the task status, I get:

{"status":"published","pendingTask":false}

What is it working with the REST api and not with the ruby wrapper ? Is the ruby wrapper performing another operation than simply delete ?

@redox
Copy link

redox commented Mar 17, 2016

I am trying to delete an object from my Algolia index in ruby.

Bot::Candidates.index.delete_object(candidate_id)
I get the following error:

Cannot DELETE to https://MYID.algolia.net/1/indexes/candidates/: {"message":"Method not allowed with this API key","status":403}

I think your candidate_id is nil, making the https://MYID.algolia.net/1/indexes/candidates/<OBJECT_ID> URI to be https://MYID.algolia.net/1/indexes/candidates/ which is actually the URL to delete the whole index /o\

I'll add a check to ensure no one does that :)

@redox redox closed this as completed Mar 17, 2016
@redox redox reopened this Mar 17, 2016
@redox redox closed this as completed in b27d584 Mar 17, 2016
@thibauld
Copy link
Author

Indeed, you are right. Sorry for the misleading bug report ! I was mislead myself by the error message :)

@redox
Copy link

redox commented Mar 17, 2016

Indeed, you are right. Sorry for the misleading bug report ! I was mislead myself by the error message :)

That's fine :) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants