Search

hello ,

I have added the extension of REST API to symphony.

I have tried accessing it with Google chrome's RESTClient addons and it is working.

Now,I need to integrate this API with .net web app or javascript also I need to see whether I can save the data locally to the database.Is there any sample available ?

Regards Sonam Gupta

Hi Sonam,

I don't think we have any ready-made API connections in particular with .net, someone might have fiddled with some Javascript but I doubt that is readily available.

Are you trying to read data from Symphony and saving it in another app and/or the browser?

hello ,

Yes I am trying to do the same. Javascript sample would also help.

How can I access the API in javascript or .net web app?

Regards Sonam Gupta

@gunglien..Please support

Hi sonam, please do not create new threads asking the same question.

AFAIK there is no sample data for what you are trying to achieve. It sounds like what you actually would like is an example of how to consume a REST API in .net or Javascript. Perhaps try to Google with that in mind?

If you're able to make requests via Chrome's RESTClient, you should be good to go.

Hi I have tried using the API with javascript(Jquery) but while accessing the API, I am getting

"XMLHttpRequest cannot load http://localhost/symphony/symphony/api/authors. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:50381' is therefore not allowed access. The response had HTTP status code 403." error.

I have installed extension "http response header mapping" and updated the config.php as per the readme file as

'alloworiginfake' => 'Access-Control-Allow-Origin',
        'alloworigin' => 'Access-Control-Allow-Origin: *',

then also I am getting the same error.Do I have to change something else ?

I am not familiar with the http response header mapping extension. To resolve the issue you mention the easiest is to remove the header I believe. I usually do this with the following:

  1. Create an extension with FrontendPreRenderHeaders delegate (if you don't know probably the extension you mention already has this

  2. Add the following line within the function called by the above delegate.

    $frontendPage->removeHeaderFromPage('Access-Control-Allow-Origin');

If you still have problems it's with the access control not specifically with the symphony setup of how you've set up the API etc, as for security reasons most browsers do not allow you to do certain things in cross-domain.

If you use the HTTP Response Header Mappings extension, you must know two things:

  • you must add the page type (defined in the config file) to your page
  • you must control if the HTTP header really looks as desired; I wouldn't rely on the browser's debugging console; I normally use curl in the Terminal or the "Rested" application (Mac)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details