Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

No way to use with javascript - browser. #10

Open
FlauzerOriginal opened this issue Jan 5, 2023 · 1 comment
Open

No way to use with javascript - browser. #10

FlauzerOriginal opened this issue Jan 5, 2023 · 1 comment

Comments

@FlauzerOriginal
Copy link

Hi, I just signed up to test your product. In particular forward and reverse api.
I'm reading the documentation (https://positionstack.com/documentation), and issuing RUN API requests...but also writing my own code, I have the same problem.

At every test, I got this result....

{"error":{"code":"https_access_restricted","message":"Access Restricted - Your current Subscription Plan does not support HTTPS Encryption."}}

CODE:

`const Http = new XMLHttpRequest();
const url='http://api.positionstack.com/v1/reverse?access_key=<MyAPI>&query=<lat,long>';
Http.open("GET", url);
Http.send();

Http.onreadystatechange = (e) => {
	console.log(Http.responseText)
}`

BUT, with simple code in vbscript this works...

Dim o Set o = CreateObject("MSXML2.XMLHTTP.3.0") o.open "GET", "http://api.positionstack.com/v1/reverse?access_key=<MyAPI>&query=<lat,long>, False o.send MsgBox o.responseText

Do you have any tips or tricks to work with the browser (javascript) ?

Thanks in advance.


@ritvikkolhe
Copy link

Try using a different HTTP client library such as Axios or Fetch in your code instead of XMLHttpRequest. These libraries may have better support for HTTPS encryption and may work better with the Positionstack API.
If none of these work you might need to upgrade your subscription plan to one that supports HTTPS encryption.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants