+ 1
Does API works on sololearn.
3 Antworten
+ 3
So vague your question. Out of the millions services providing APIs, you don't even mention which API ...
Better to edit that question, even better add more Description to clarify your doubt.
https://www.sololearn.com/Discuss/333866/?ref=app
(Edit)
OP had posted a new thread with more info
https://www.sololearn.com/discuss/2861181/?ref=app
+ 1
In js I think sololearn does’t allow api. If you request api in the js window it won’t work
But if you put your js inside html it will work.
https://code.sololearn.com/WelfVZv2STg4/?ref=app
+ 1
Yes. In order to use a REST Api on SoloLearn (using JS), you will need to use fetch or XHR to communicate with a server using POST, GET, PUT, and other HTTP methods.
If you want to use fetch(), read this documentation:
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
You can also use XHR (XMLHttpRequest):
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
From there on, you can learn how to use an API. For a list of free-to-use APIs, check out https://github.com/public-apis/public-apis
Note that if the API you are using requires some kinf of authentication, password, or token, the token will be visible to anyone who has access to your source code, which would be a public SoloLearn code.