Jump to content
php.lv forumi
  • 0

Odnoklassniki API


freak

Question

Vai ir te kāds , kas ir saskāries ar odnoklassniki API?

 

 

Nekādīgi nestrādā publicēšana strīmā (runā). It kā viss notiek, tikai nekas neparādās pie tekstiem.

Javascript kods:

<script type="text/javascript" charset="utf-8">

FAPI.init('http://api.odnoklassniki.ru/', key,
 function() {
  	//success
 	FAPI.UI.initialize();

 }, function(error){
	alert("API initialization failed");
 });

 var viral_post_to_stream = {};
 function viral_post() {
viral_post_to_stream = {
 	"method" : "stream.publish",
 	"message" : text.',
 	"action_links" :
   	'[{"text":"text.","href":"from=stream_global"}]',
 	"application_key" : FAPI.UI.applicationKey,
 	"session_key" : FAPI.UI.sessionKey,
 	"format" : FAPI.UI.format,
 	"attachment": '{"caption":"text", "media":[{"href":"link","src":"/images/app_icons/v2/128x128.jpg","type":"image"}]}'
};
var sig = FAPI.Util.calcSignature(viral_post_to_stream, FAPI.UI.sessionSecretKey);
FAPI.UI.showConfirmation(
 	"stream.publish",
 	'test.',
 	sig
);
 }
 // CALLBACK for stream.publish
 function API_callback(method, status, attributes) {
if(method == 'showConfirmation' && status == 'ok') {
 	viral_post_to_stream["resig"] = attributes;
 	FAPI.UI.call(
   	viral_post_to_stream,
   	function(status2, data2, error2) { }
 	);
}
 }

</script>

Edited by freak
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Tā kā nācās pašam iet cauri šai problēmai, ja kādam vēl ievajagas, vēsturei pieliku pašlaik strādājošo versiju:

<script type="text/javascript" charset="utf-8">
FAPI.init('http://api.odnoklassniki.ru/', key,
function() {
//success
FAPI.UI.initialize();
}, function(error){
alert("API initialization failed");
});
var viral_post_to_stream = {};
function viral_post(postText) {
viral_post_to_stream = {
   	"method" : "stream.publish",
   	"message" : postText,
   	"action_links" : '[{"text":"text.","href":"frompublished"}]',
   	"attachment": '{"caption":"text", "media":[{"href":"link","src":"/images/app_icons/v2/128x128.jpg","type":"image"}]}'
};
var sig = FAPI.Client.calcSignature(viral_post_to_stream);
FAPI.UI.showConfirmation("stream.publish", postText, sig);
}
// CALLBACK for stream.publish
function API_callback(method, status, attributes) {
if(method == 'showConfirmation' && status == 'ok') {
   	FAPI.UI.call(
       	viral_post_to_stream,
       	function(status2, data2, error2) { },
       	attributes
   	);
}
}
</script>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...