Forum Discussion

irfansofttech's avatar
8 years ago

HI can't create user using lithium post request 500 error.

I am following this link. I can successfully make get requests following other tutorials. But when I made a post request like given in the link, I get a 500 error. Here are my example params with headers and url (correct but now shared here)

{:first_name=>"zeeshan", :last_name=>"khan", :login=>"zeeshan", :email=>"zeeshan.khan@softtechgroup.us", :password=>"zeeshan.khan@softtechgroup.us", :type=>"user"}

Please let me know whats wrong with the request. and if possible, Can I play around with request, like there is a playground or something for testing?

    • irfansofttech's avatar
      irfansofttech
      Helper

      I am using ruby on rails and these are correct parameters. Thanks for your reply

    • irfansofttech's avatar
      irfansofttech
      Helper

      Is there any API playground or API web Ui testing feature available? So that I can figure our the issue. I got 500 in response

      • Parshant's avatar
        Parshant
        Boss
        Hi irfansofttech,

        Before making a Community API v2 Create, Update, or Delete call, use the /allowed endpoint to ensure that the current user is allowed to perform the action. You can use the response, for example, to determine whether or not to display a button to give kudos or write a product review.

        Say you need to make a POST call to add a kudo to an image (image ID=74):

        https://api.lithium.com/community/2.0/<mytenantid>/images/74/kudos

        check to see if that call was allowed:

        https://api.lithium.com/community/2.0/<mytenantid>/allowed?method=post&path=images/74/kudos

        Depending on the result (true or false), you might choose to gray out the give kudos button, not show it at all, display a message if the user cannot perform the action, or some other option.

        Note that you do not use the /allowed endpoint for Read/GET calls. LiQL queries automatically return results based on the privileges and permission of the user making the call.