R
R
Richard Popov2015-06-04 11:00:12
Classmates
Richard Popov, 2015-06-04 11:00:12

Is it possible to send requests to the OK API (REST API) from the HTML page of an external site via JS?

Is it possible to send requests to the OK API from the HTML page of an external site via JS? I have already tried a bunch of options with jsonp (crossdomain request) - callback is not called.

$.ajax({
  url: 'http://api.ok.ru/fb.do',
  jsonp: false,
  jsonpCallback: 'callback',
  dataType: "jsonp",
  cache: true,
  data: params,
  success: callback,
  error: function (x, t, m) {
    if (t == 'timeout') {
      request();
    }
  },
  timeout: 30000
});

Also tried via FAPI but it only works for iframe apps inside OK

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vjacheslav Kanivetc, 2015-06-04
@mrbowie

REST api is always available, but in the case of an external page, at least OAUTH authorization is required first apiok.ru/wiki/pages/viewpage.action?pageId=81822117 ?pageId=75989046 An example (php) can be viewed from https://github.com/apiok/php_sdk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question