Forum Discussion

SheryBulos's avatar
5 years ago

how to make implement endpoint with ajax?

Hello everyone, My question is how can I implement endpoint  to achieve this? specifically I want to make endpoint that   1. take as a parameter file name   2. get the file from the assets by...
  • peterlu's avatar
    peterlu
    5 years ago

    SheryBulos The only way to do server side parsing is via Endpoint. Endpoint supports Http Client API (see Khoros doc for HTTP Client https://developer.khoros.com/khoroscommunitydevdocs/reference/httpclientrequest). So you put the JSON file in /html/assets or AWS S3 bucket. Then use HTTP client api to fetch the json. The JSON object cannot be too complicated. I think you only supports plain simple JSON object. You can have a try.

    Then you will have to use frontend javascript AJAX to talk to the endpoint. So the endpoint behaves like a proxy.

    Another way to do it, is to put the JSON in AWS S3 bucket and open the CORS policy. So your frontend AjAX can pull JSON from AWS S3 directly. This way, the JSON object can have any structure.