- Unleash the Power of Issuu: A Comprehensive Guide to the Issuu API
- Publish Document flow
- Other useful endpoints
- Updating a document
Unleash the Power of Issuu: A Comprehensive Guide to the Issuu API
Have you ever wanted to automate document publishing on Issuu? Look no further than the Issuu API! This guide will equip you with the knowledge and specific code examples to effectively leverage the Issuu API, unlocking its full potential for streamlining your workflow.
This comprehensive introduction will walk you through:
- Creating Drafts: Learn how to initiate a new publication on Issuu through the API, including setting basic information like title and access permissions.
- Uploading Documents: Discover two methods for uploading your document to the draft: directly through a file or by providing a file URL.
- Publishing Drafts: Understand the steps involved in making your draft live on Issuu, with the option to assign a custom name.
- Additional Endpoints: Explore functionalities beyond publishing, including accessing document statistics and managing existing publications (deletion and updates).
By following this step-by-step approach, you'll gain the confidence to utilize the Issuu API and enhance your Issuu publishing experience. So, dive in and unlock the power of automation!
Publish Document flow
Create a draft
curl --location '<https://api.issuu.com/v2/drafts>' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer %YOUR_TOKEN%' \\
--data {
"confirmCopyright": true,
"fileUrl": "string",
"info": {
"access": "PUBLIC",
"title": "string",
"description": "string",
"preview": false,
"type": "editorial",
"showDetectedLinks": true,
"downloadable": true,
"originalPublishDate": "2024-01-28T11:24:22.343Z"
}
}'
You will receive a slug for the next endpoints if you don’t have a fileUrl you should remove the confirmCopyright and fileUrl properties
Upload Document by file
curl --location --request PATCH '<https://api.issuu.com/v2/drafts/%YOUR_SLUG%/upload>' \\
--header 'Authorization: Bearer %YOUR_TOKEN%' \\
--form 'file=@"%FILE_PATH%"' \\
--form 'confirmCopyright="true"'
Then you will have to wait until the response return
fileInfo.conversionStatus === "DONE"
To know this you can call the get draft endpoint
curl --location '<https://api.issuu.com/v2/drafts/%YOUR_SLUG%>' \\
--header 'Authorization: Bearer %YOUR_TOKEN%'
Publish Draft
curl --location '<https://api.issuu.com/v2/drafts/%YOUR_SLUG%/publish>' \\
--header 'Content-Type: application/json' \\
--header 'Authorization: Bearer %YOUR_TOKEN%' \\
--data '{
"desiredName": "string"
}'
Other useful endpoints
Get statistics
curl '<https://api.issuu.com/v2/stats?dateRange=maxTime&slug=%YOUR_SLUG%>' \\
--header 'Authorization: Bearer %YOUR_TOKEN%'
You can remove the Slug to get statistics for all documents
Delete document
curl --location --request DELETE '<https://api.issuu.com/v2/publications/%YOUR_SLUG%>'
--header 'Authorization: Bearer %YOUR_TOKEN%'
Updating a document
Re-upload
When you need to update a document, you can use the PATCH Upload Document by file
endpoint. This endpoint enables you to patch the existing draft with a new file, allowing you to make updates or revisions to the document content.
Here's the basic flow for re-uploading a document using the Issuu API:
curl --location --request PATCH '<https://api.issuu.com/v2/drafts/%YOUR_SLUG%/upload>' \\
--header 'Authorization: Bearer %YOUR_TOKEN%' \\
--form 'file=@"%FILE_PATH%"' \\
--form 'confirmCopyright="true"'
Here's how it works:
- Replace
%YOUR_SLUG%
with the actual slug of your draft (obtained when creating the draft). - Replace
%FILE_PATH%
with the path to your new document on your local machine. - Execute the
curl
command to upload the new document.
Once the new file has been successfully uploaded and processed, you can publish the draft using the "Publish Draft" endpoint.
NOTE:
- This method replaces the entire document in the draft. It doesn't allow for selective updates or modifications to specific parts.
- You don't need to remove the existing document before uploading the new one. The API automatically handles the replacement.
Update the data
curl --request PATCH '<https://api.issuu.com/v2/drafts/%YOUR_SLUG%>' \\
--header 'Authorization: Bearer %YOUR_TOKEN%'
--data '{
"confirmCopyright": false,
"fileUrl": "string",
"info": {
"access": "PUBLIC",
"title": "string",
"description": "string",
"preview": false,
"type": "editorial",
"showDetectedLinks": false,
"downloadable": false,
}
}'
After every change, it is necessary to publish with publish draft Publish Draft without the desired name that cannot be changed.
Comments
0 comments
Article is closed for comments.