Closed pablocarrillo closed 10 years ago
Hmm....I wold say there is no issue with the web based version you see in Chrome because you get the HTML back. If there was an error on the frontend where the templates are stored then you wouldn't get back the HTML, just an error.
If you call http://app.wf-staging.co.uk/app/article, which is the URL the API calls to get the HTML then you get the error because it wont accept a GET request (only) post and requires certain params the API provides when it does its POST.
Hmmm..... Let me have a think.
Does your test script do anything other than make a GET request to http://api.wf-cycle.co.uk/articles?subchannel=71&category=17&article=226
Not, neither the app and I just made a simple curl to the address and it works. This getting more and more strange ...
Ok, I found the culprit.
if I do not send the BristolAPIClient it works, so at this moment I am going to a deactivate I think this need you to accept it in the server.
Why does that break it for you?
Im only using that at the moment to determine whether I should send back mobile only data or the web version.
Well I agree that is very strange indeed but as soon I take off the header the thing works, and if I put it back break again. maybe are you passing that header also to the frontend?
I can also reproduce the error in the Advanced RestClient for Chrome adding the header to the get request
.....if I change the BristolAPIClient header to anything else, BristolAPIClient1 for example, it works.
If I remove the HTML response from the front end and replace it with any string, it works.
Maybe the front end and the API use that to talk to each other, but with some other meaning?
Right I know why its doing it..... For every call you make to the API you send the BristolApiClient header variable. This is used throughout the system to remove the data you dont usually want to see, such as URL paths (because you use ID's), alt and title tags for images and so on.
However in the case of the article call some of this information is needed to populate the HTML template. So, because we are removing the information as we get the article details its then not available in the object that populates the template and is causing an error on the front end server.
Im going to need to implement a different transformer that ignores the header param and returns everything so the template has it all there to work with I think.
This should be fixed for you now. Phew. That was a tough one!
Indeed ! Many thanks
If I put the address on chrome I get the JSON, but if I do the same with the python scripts or the iOS App I get a 500 error
This is the log:
The weird thing is I am taking directly the address from the log and paste in on chrome and everything is good