Try the fastest and simplest way to install ONLYOFFICE

How to use callbackURL?!

Integration questions/issues

How to use callbackURL?!

Postby weissb95 » Sat Sep 23, 2017 11:39 pm

I am trying to follow the 'Basic Concepts' page of the Document Server for me to integrate the API into my own website. I have the document server running and i can test that using the index.html that comes with the onlyoffice document server installation.

Now when trying to incorporate the API, im running into trivial issues that i cant seem to hurdle over because the 'Basic Concepts' page is not so basic.

I can fully comprehend what these 2 lines of HTML code mean:
Code: Select all
<div id="placeholder"></div>
<script type="text/javascript" src="http://documentserver/web-apps/apps/api/documents/api.js"></script>


creating a div tag that will contain the editor once its instantiated, and a script to call the API. now i did change the 'documentserver' to my ip address.
the next part is where im having trouble..

this line of javascript:
Code: Select all
var docEditor = new DocsAPI.DocEditor("placeholder", config);
does it belong in a new script tag... or does it belong in between the script tags previously created for the API?

secondly, i assume we declare the config object as so:

Code: Select all
var config = config = {
    "document": {
        "fileType": "docx",
        "key": "Khirz6zTPdfd7",
        "title": "Example Document Title.docx",
        "url": "http://example.com/url-to-example-document.docx"
    },
    "documentType": "text",
    "editorConfig": {
        "callbackUrl": "http://example.com/url-to-callback.ashx"
    }
};


the issue im having is i dont understand what the callbackUrl is supposed to be.
in the document property... i declared the title the same name as a sample docx file i have in the directory of my webserver.
i declared the url to be: http://webserver_ip_address/example.docx because this is where my sample docx is located

im not sure what to put in for the callbackURL though. I am trying to get this running asap and would love to have this resolved immediately.
Your help is kindly appreciated.
weissb95
 
Posts: 3
Joined: Mon Sep 11, 2017 7:40 pm

Re: How to use callbackURL?!

Postby bclauss » Mon Sep 25, 2017 9:09 am

Hey,

Do you have a PHP, java, c# server ? In fact you must have a server that will save your document.

So in your config object, you will have :
Code: Select all
    ...
    "documentType": "text",
    "editorConfig": {
        "callbackUrl": "http://yourserver_address/url-to-callback.ashx"
    }
};


Then you can create a servlet like this examples : https://api.onlyoffice.com/editors/callback#csharp In this case it is a c# server.
bclauss
 
Posts: 15
Joined: Mon Sep 18, 2017 9:06 am

Re: How to use callbackURL?!

Postby Maxim » Thu Sep 28, 2017 10:58 am

The document editing service informs the document storage service about status of the document editing using the callbackUrl from JavaScript API.
Maxim
 
Posts: 1179
Joined: Tue Oct 11, 2016 2:34 pm


Return to API

Who is online

Users browsing this forum: No registered users and 1 guest

cron