Editor SDK
Editor SDK Requires Business Plan
The Editor SDK is generally used to integrate panoramic editing functions into your project, providing your users with a visual panoramic editing service. It requires you to obtain an API Token on the server side through easepano’s APIs, and provide editing permissions for the front-end Editor SDK.
API Token
The API token is used for authentication of operations. It is a string that starts with AT- and is followed by 32 random characters. and it is generated from the token API through the API Key. Please make sure that the API token is generated in a secure and controllable environment, and do not generate it on the user’s browser.
Here are the steps to use the SDK:
- Add Editor SDK js file
https://common.easepano-cdn.com/sdk/easepanoEditor.jsto your webpage.
<script src="https://common.easepano-cdn.com/sdk/easepanoPlayer.js"></script>
- After you get the API Token from your server (step 4 in the picture, View API documentation), you can initialize an editor through the easepanoEditorSetup method.
window.easepanoEditorSetup({
token: '{API Token}',
projectID: '{Project ID}',
backURL: '{Back URL}',
backTitle: '{Back Title}',
errorCallback: (code, message) => {
console.log(code, message);
},
});
-
params:
- token: API Token from your server, see here.
- projectID: Project ID
- backURL: You can specify which url the editor returns to by using the backURL parameter. If you do not specify this parameter, the editor will return to the previous page.
- backTitle: You can specify the title of the back button by using the backTitle parameter. If you do not specify this parameter, the default title is “Back”.
- errorCallback: If an error occurs during the initialization process, the errorCallback will be called. The errorCallback has two parameters: code and message. The code is the error code, and the message is the error message.
-
Error Code (errorCallback code parameter):
- 401: Token is invalid or Token is expired, please regenerate the API token.
- 404: Project is not found, please confirm if the id is correct.
- 500: Internal server error, If this happens again, please contact us.