The hihaho API offers a seamless solution for integrating interactive videos into your applications. Follow the API documentation available at https://api-docs.hihaho.com/ to leverage the power of hihaho and enhance your video content.
In this article, we'll help you get started by going through a few steps together.
When you follow the following steps you will be able to automatically upload a video to hihaho from your own application.
How to use the hihaho API
First authorize with the API.
To initiate the upload process, you need to use the register upload endpoint. This endpoint will provide you with an ID and a URL as a response. The URL received is the destination where you should upload your video file. The ID can be used to check the status of the upload or receive webhook updates about his upload.
To upload the video file, you can use a Curl command. Here's an example:
curl --request PUT --upload-file /file_path/file_name.mp4 \
"https://upload-s3.jwplatform.com/tL17msiU?AWSAccessKeyId=[AWSAccessKeyId]&Expires=1482770374&Signature=[Signature]"Replace
/file_path/file_name.mp4
with the actual path and name of your video file.
If you choose to upload the video file using XHR or Fetch, ensure that you include the Content-Type header. The header value should be a space to match the AWS signature correctly. Here's an example using Axios:
return axios.put(response.data.url, file, {
...axiosConfig,
headers: {
'Content-Type': ' ',
},
onUploadProgress: (progressEvent: any) => this.uploadProgress(progressEvent, file), })Once the upload is complete, the video undergoes transcoding and thumbnail generation processes. It's important to note that the video won't be immediately available. You can check the transcoding status by using the V2 - transcoding statuses endpoint. Alternatively, you can specify a webhook URL within hihaho for a specific video folder. By doing so, you will receive a notification on the specified URL when the upload process is complete.
When an upload is finished, a webhook POST request will be sent to the provided URL. The request body will contain the following JSON data:
Success:
{
"upload_id": 1,
"upload_status": 7,
"upload_successful": true,
"video_container_id": 1,
"video_id": 1
}
Failure:
{
"upload_id": 1,
"upload_status": 11,
"upload_successful": false,
"video_container_id": 1,
"video_id": null
Once these steps are done, you have successfully uploaded your first video to hihaho. The video is now ready to make interactive, this can be done in the hihaho studio or via this API.
Want more with API than is described in these steps? Read more about some of the possibilities or check out our API documentation.