B
B
Bart1212015-06-01 17:04:54
Classmates
Bart121, 2015-06-01 17:04:54

How to call the Odnoklassniki API method using JS on the client?

Tell me, how can I call the classmates API method (for example, users.getCurrentUser) on the client side using JS?
Tried to make a call via JSONP and CORS.
1. When using JSONP (preferred), the callback function is not called. Tried using standard call in jquery and also explicitly specifying jsonp and callback parameters. In all cases, a pure JSON object is returned.
2. CORS throws an error that Access-Control-Allow-Origin is not set.
The response from the server comes with the following headers:
HTTP/1.0 200 OK
Server: Apache-Coyote/1.1
invocation-error: 102
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Cache-Control: no-cache , no-store
Content-Type: application/xml;charset=utf-8
Content-Language: en-US
Content-Length: 227
Date: Mon, 01 Jun 2015 14:00:55 GMT
X-Cache: <hidden to hide network>
Via : <hidden so as not to shine the network>
Connection: keep-alive
Proxy-Connection: keep-alive

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vjacheslav Kanivetc, 2015-06-01
@Vjaka

For a portal app: I recommend looking at the apptop
example on github (the app from this example is demographic top ). A simple solution is to connect the javascript-wrapper API (fapi5.js) and use the wrappers it offers. Documentation FAPI @ apiok.ru In your version (most likely) the request itself is incorrectly composed. For an external site: First you need to perform OAUTH authorization, as a result you will receive a token with which you can directly make REST requests. An example can be viewed from https://github.com/apiok/php_sdk . wiki OAUTH: apiok.ru/wiki/pages/viewpage.action?pageId=81822117 wiki REST request calculator:
apiok.ru/wiki/pages/viewpage.action?pageId=75989046

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question