Forum Discussion
Thank you for all these information AdamA, everything is working almost perfectly fine, except for the last step, the actual "Add a me too".
I have successfully logged in in the name of the user, and have tested API calls through AJAX like fetching a given message (testing the read permissions), or editing an existing message (testing the writing permissions). Both of those calls worked well.
As for the AJAX Post call to "/messages/id/<message-id>/ratings/key/question_metoo/ratings/add?rating.value=1" after successfully logging in, however, I keep getting the "Autorisation refusée" (Authorization refused) with a 303 code from the API.
The code is pretty straightforward :
$.ajax({ type: "POST", url: "/restapi/vc/authentication/sessions/login", data: ({ "xslt":"json.xsl" }), success: function(loginResponse) { $.ajax({ type: "POST", url: "/restapi/vc/messages/id/" + questionId + "/ratings/key/question_metoo/ratings/add?rating.value=1, data: ({ "rating.value=1", "xslt":"json.xsl" }), success: function(meTooResponse) { console.log(meTooResponse.response); } }); } });
(We are using auto-cookie login, that's why we don't have to use the session_key after loging in).
As for permissions, I have authorized API Reading and Writing Permissions in the Admin of course (the two previous successful calls I made confirm that those settings are indeed active).
Do you know why I am getting this 303 error only for Adding a Me Too to a question ? Is there a setting I might have overlooked ?
Thanks in advance for any help you can provide !
EDIT : To add more info to my post, I have also tried to make the call via the FreeMarker Rest API, and the result is the same, i.e. "Authorization Refused".
VincentGabou: I'm getting the same error.
AdamA: Do you know why this error occurs please?
best,
Clement
- VincentGabou11 years agoGuide
Thanks clemlith , glad to see I'm not the only one with this issue !
Unfortunately I'm still experiencing this suprising "Denied Access" error (even though other API write calls all proceed successfully). I checked all possible permissions and they seem to be set correctly, I am logged in as Admin but still can't get to add a Me Too to a Question programatically.
Do you have any idea what could be the reason, AdamA , by any chance ?
Thank you for any feedback you can give, I'm sure this can be solved :)
- AdamA11 years agoKhoros Oracle
Sorry for the delayed response, I was on vacation and out of the office.
I realize now that the rating.value I advised initially was incorrect, instead of 1 it should be 0. I apologize for the confusion!
/messages/id/<message-id>/ratings/key/question_met
oo/ratings/add?rating.value=0 I had the value confused with what you would want to use for our helpfulness feature, where a value of 1 means "helpful" and a value of -1 means "Not helpful". In the case of Me Too, since there is no negative variant (as in: "Not me too") the system uses a value of 0.
- sakkaoui11 years agoMentor
Hi AdamA
Sorry to come back to you after such a long time.
We have tested this new value and the good news is : it works !
The issue, now, is that I manage to add a metoo to a message programmatically, using a certain user of our test plateform. But I can find out how to reproduce this with other users.I tried to apply the same level of permissions the working user has to the others, even giving all permissions, but it seams to have no impact on the API metoo rating ability.
This is what I get using both users (and a custom Ruby Lithium API Wrapper, but the result is the same in Javascript) :l = Lithium.new => #<Lithium:0x007ff1b3daf758 @data={"basic_auth_login"=>"***", "basic_auth_password"=>"***", "domain"=>"***.fr", "login"=>"SmartPereNoel", "password"=>"***"}, @session_key=nil> l.get_session_key => "***" l.request('/messages/id/1123/ratings/key/question_metoo/ratings/add?rating.value=0', :post) => {"status"=>"success"} l = Lithium.new => #<Lithium:0x007ff1b3f5fa30 @data={"basic_auth_login"=>"***", "basic_auth_password"=>"***", "domain"=>"***.fr", "login"=>"APIUser", "password"=>"***"}, @session_key=nil> l.get_session_key => "***" l.request('/messages/id/2657/ratings/key/question_metoo/ratings/add?rating.value=0', :post) Lithium::LithiumError: [303: Forbidden]
Do you know of a special permission or setting to apply to users, so that they become able to add metto via APIs ?
Thanks !
--Stéphane Akkaoui
Related Content
- 4 years agoInactive User
- 7 months ago