Forum Discussion
Hi VincentGabou and AdamA ,
Thanks for sharing your thoughts about this features and its limitations in its current state.
If Vincent try to replicate the behavior of a me too button he has to handle all the logic related to the authentication/registration status.
And as per my understanding there's also the management and the creation of a token which is needed to perfom an action in the platform.
Indeed at the end of every URL holded by a kudo or me too button there is ticket parameter (e.g &ticket=aMivVgLAcKnS_11676)
AdamADo you know if this token / parameter is mandatory ? If yes is there a way to generate it through an api call ?
Best,
Clement
VincentGabou Yes, the rest call you referenced is the one you would use to give a me too. I believe a value of -1 is what we consider "not helpful" and a value of 1 is considered to be helpful.
Add (or change) the Me Too on a Question:
/messages/id/<message-id>/ratings/key/question_metoo/ratings/add?rating.value=1
Revoke the Me Too on a Question:
/messages/id/<message-id>/ratings/key/question_metoo/ratings/revoke
clemlith If this is used in the context of a custom component, as freemarker code, then the call will be made as the current user. If made via REST over HTTP then you would need to use one of our auth mechanisms to make the call as the current user. One of the mechanisms is to pass a sso.authentication_token along with the request (if you are using SSO). This token can be generated by using a REST call (see links below for more details). Please note that the sso.authentication_token is different that the token (aka ticket) used by the application that you saw in the out-of-the-box UI (ticket=aMivVgLAcKnS_11676). The token used by the out-of-the-box UI is not intended to be used for REST or for customizations. Also, the action links in the OOTB UI are not intended to be used when building customizations, the REST API should be used in those cases.
Auth for Non SSO:
http://community.lithium.com/t5/Single-Sign-On-SSO/Authenticating-via-REST-API-non-SSO/ta-p/61862
Auth for SSO:
https://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?page=authentication#sso
- VincentGabou11 years agoGuide
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".
- clemlith11 years agoExpert
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 :)
Related Content
- 4 years agoInactive User
- 7 months ago