AnsweredAssumed Answered

Access Rest API from logic hook

Question asked by Monalisa B on Dec 24, 2018
Latest reply on Jan 1, 2019 by hats



I have a requirement of converting lead into contact on import once they satisfy some condition.

I have written a logic hook and trying to call the rest api endpoint : convert

But the rest api does not work . I tried sending sessionid in the OAuth-Token in header (I found this idea in sugar community forum ), but I get the below error:

 "error":"invalid_grant","error_message":"Your authentication token is invalid.


If I call login rest api, and then send the id received in response as OAuth-token, it works.

But I don't want to call the login api with hard coded username and password.

Is there anyway, the rest api can work from the logic hook , without having to call login through rest api first.

Has anyone come across such a requirement? kindly let me know the steps you followed.


If anyone has any suggestions, please let me know.