How to consume an API "without permission" [duplicate]

0

In the searches I did, I discovered that it is not possible to consume an API if it does not release its host on the server (backend), but I hope it is mistaken, this is the reason for this question, is there any method to consume an API "without permission"?

My problem is the following, I want to search the status of a tag in INPI, I searched and did not find any APIs.

This is the link where it is possible to search.

INPI has joined the European Trade Mark and Design Network and it is also possible to do this search .

Using the browser "Inspector" on the network tab you can find the following on the European Trade Mark and Design Network website: url in which a json is returned with the result I want, however when I try to insert this url in my application it has the following error in the console. p>

  

Cross-origin request blocked: Same source policy (Same   Origin Policy) prevents the remote resource from being read   a 22test% 22 & fq =% 5B% 5D & pageSize = 10 & facetQueryType = 2 & providerList = null & expandedOffices = null & interfacelanguage = in & selectedRowRefNumber = null "> link .   (Reason: CORS 'Access-Control-Allow-Origin' header is not   present). [Learn More]

     

Cross-Origin Request Blocked: The Same Origin Policy disallows reading   the remote resource at   a 22test% 22 & fq =% 5B% 5D & pageSize = 10 & facetQueryType = 2 & providerList = null & expandedOffices = null & interfacelanguage = in & selectedRowRefNumber = null "> link .   (Reason: CORS request did not succeed.) [Learn More]

I have already found the following "solution"

"c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="C:/Chrome dev session" --disable-web-security

In this way Google Chrome is started however ignoring "web security" and allowing CORS, but the user will not do this to access my application.

All my tests were local, I'm using Angular 6.1.5, this is the code snippet in which I'm trying to fetch the information, I do not think I need it, but if necessary put the complete code.

return this.http.get(url)
    .toPromise()
    .then((resposta: any) => {
        console.log(resposta);
        return resposta;
    }).catch(this.handleError);
    
asked by anonymous 27.10.2018 / 06:13

1 answer

5

No, you can not make a direct request from your domain, this protection exists to bar sites from using resources from other domains as your own. You can however send a request to your server, then from your server send a request to INPI, thereby preventing the browser from sweeping the request by being cross-origin.

    
27.10.2018 / 08:05