This REST API allows to add multiple annotations to the document
API usage
There are steps that usage of GroupDocs.Annotation Cloud consists of:
Upload input document into cloud storage and other files, like image annotation (using File API)
Add annotation(s)
Download document with annotations (using File API)
HTTP POST ~/annotation/add
Swagger UI lets you call this REST API directly from the browser.
cURL example
# First get JSON Web Token# Place your Client Id and Client Secret in the environment variables CLIENT_ID and CLIENT_SECRET.curl -v "https://api.groupdocs.cloud/connect/token"\
-X POST \
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET"\
-H "Content-Type: application/x-www-form-urlencoded"\
-H "Accept: application/json"# cURL example to add annotations into documentcurl -v "https://api.groupdocs.cloud/v2.0/annotation/add"\
-X POST \
-H "Content-Type: application/json"\
-H "Accept: application/json"\
-H "Authorization: Bearer $JWT_TOKEN"\
-d '{
"FileInfo": {
"FilePath": "annotationdocs/ten-pages.docx"
},
"OutputPath": "Output/output.docx",
"Annotations": [
{
"Type": "Area",
"Text": "This is area annotation",
"CreatorName": "Anonym A.",
"Box": { "X": 100, "Y": 100, "Width": 100, "Height": 100 },
"PageNumber": 0,
"AnnotationPosition": { "X": 1, "Y": 1 },
"PenStyle": "Solid",
"PenColor": 65535,
"PenWidth": 3
},
{
"Type": "Point",
"CreatorName": "Anonym A.",
"Box": { "X": 375, "Y": 59, "Width": 88, "Height": 37 },
"PageNumber": 2,
"AnnotationPosition": { "X": 852, "Y": 59 },
"PenStyle": "Solid",
"PenColor": 65535,
"PenWidth": 3
}
]
}'
# First get JSON Web Token# Set your credentials in the environment variables CLIENT_ID and CLIENT_SECRET.curl.exe-v"https://api.groupdocs.cloud/connect/token"`-XPOST`-d"grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET"`-H"Content-Type: application/x-www-form-urlencoded"`-H"Accept: application/json"# cURL example to add annotations into documentcurl.exe-v"https://api.groupdocs.cloud/v2.0/annotation/add"`-XPOST`-H"Content-Type: application/json"`-H"Accept: application/json"`-H"Authorization: Bearer $env:JWT_TOKEN"`-d'{
"FileInfo": {
"FilePath": "annotationdocs/ten-pages.docx"
},
"OutputPath": "Output/output.docx",
"Annotations": [
{
"Type": "Area",
"Text": "This is area annotation",
"CreatorName": "Anonym A.",
"Box": { "X": 100, "Y": 100, "Width": 100, "Height": 100 },
"PageNumber": 0,
"AnnotationPosition": { "X": 1, "Y": 1 },
"PenStyle": "Solid",
"PenColor": 65535,
"PenWidth": 3
},
{
"Type": "Point",
"CreatorName": "Anonym A.",
"Box": { "X": 375, "Y": 59, "Width": 88, "Height": 37 },
"PageNumber": 2,
"AnnotationPosition": { "X": 852, "Y": 59 },
"PenStyle": "Solid",
"PenColor": 65535,
"PenWidth": 3
}
]
}'
:: First get JSON Web Token:: Place your credentials in the environment variables CLIENT_ID and CLIENT_SECRET.curl -v "https://api.groupdocs.cloud/connect/token"^
-X POST ^
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%"^
-H "Content-Type: application/x-www-form-urlencoded"^
-H "Accept: application/json":: cURL example to add annotations into documentcurl -v "https://api.groupdocs.cloud/v2.0/annotation/add"^
-X POST ^
-H "Content-Type: application/json"^
-H "Accept: application/json"^
-H "Authorization: Bearer %JWT_TOKEN%"^
-d "{\"FileInfo\":{\"FilePath\":\"annotationdocs/ten-pages.docx\"},\"OutputPath\":\"Output/output.docx\",\"Annotations\":[{\"Type\":\"Area\",\"Text\":\"This is area annotation\",\"CreatorName\":\"Anonym A.\",\"Box\":{\"X\":100,\"Y\":100,\"Width\":100,\"Height\":100},\"PageNumber\":0,\"AnnotationPosition\":{\"X\":1,\"Y\":1},\"PenStyle\":\"Solid\",\"PenColor\":65535,\"PenWidth\":3},{\"Type\":\"Point\",\"CreatorName\":\"Anonym A.\",\"Box\":{\"X\":375,\"Y\":59,\"Width\":88,\"Height\":37},\"PageNumber\":2,\"AnnotationPosition\":{\"X\":852,\"Y\":59},\"PenStyle\":\"Solid\",\"PenColor\":65535,\"PenWidth\":3}]}"
The API is completely independent of your operating system, database system or development language. We provide and support API SDKs in many development languages in order to make it even easier to integrate. You can see our available SDKs list here.
// For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-dotnet-samplesstringMyAppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloudstringMyAppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloudvarconfiguration=newConfiguration(MyAppSid,MyAppKey);varapiInstance=newAnnotateApi(configuration);varfileInfo=newFileInfo{FilePath="ten-pages.pdf"};AnnotationInfo[]annotations={newAnnotationInfo{AnnotationPosition=newPoint{X=1,Y=1},Box=newRectangle{X=100,Y=100,Width=100,Height=100},PageNumber=1,BackgroundColor=65535,PenColor=65535,PenStyle=AnnotationInfo.PenStyleEnum.Solid,PenWidth=3,Opacity=0.7,Type=AnnotationInfo.TypeEnum.Area,Text="This is area annotation",CreatorName="Anonym A.",Replies=newList<AnnotationReplyInfo>{newAnnotationReplyInfo{Comment="First comment",RepliedOn=DateTime.Now},newAnnotationReplyInfo{Comment="Second comment",RepliedOn=DateTime.Now}}},newAnnotationInfo{AnnotationPosition=newPoint{X=852,Y=59.388262910798119},Box=newRectangle{X=375.89276123046875,Y=59.388263702392578,Width=88.7330551147461,Height=37.7290153503418},PageNumber=2,PenColor=1201033,PenStyle=0,PenWidth=1,Type=AnnotationInfo.TypeEnum.Area,CreatorName="Anonym A."},newAnnotationInfo{AnnotationPosition=newPoint{X=852,Y=59.388262910798119},Box=newRectangle{X=375.89276123046875,Y=59.388263702392578,Width=88.7330551147461,Height=37.7290153503418},PageNumber=4,Type=AnnotationInfo.TypeEnum.Point,CreatorName="Anonym A."},newAnnotationInfo{AnnotationPosition=newPoint{X=852,Y=59.388262910798119},Box=newRectangle{X=375.89276123046875,Y=59.388263702392578,Width=88.7330551147461,Height=37.7290153503418},PageNumber=5,PenColor=1201033,PenStyle=0,PenWidth=1,Type=AnnotationInfo.TypeEnum.Arrow,CreatorName="Anonym A."}};varoptions=newAnnotateOptions{FileInfo=fileInfo,Annotations=annotations.ToList(),OutputPath="Output/output.pdf"};varlink=apiInstance.Annotate(newAnnotateRequest(options));Console.WriteLine("AddMultipleAnnotations: Multiple Annotation added: "+link.Title);
// For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-java-samples
StringMyAppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
StringMyAppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
Configurationconfiguration=newConfiguration(MyAppSid,MyAppKey);AnnotateApiapiInstance=newAnnotateApi(configuration);// Create annotation/s.
AnnotationInfo[]annotations=newAnnotationInfo[4];annotations[0]=newAnnotationInfo();Pointpt=newPoint();pt.setX(1.0);pt.setY(1.0);annotations[0].setAnnotationPosition(pt);Rectangler=newRectangle();r.setX(100.0);r.setY(100.0);r.setWidth(200.0);r.setHeight(100.0);annotations[0].setBox(r);annotations[0].setPageNumber(0);annotations[0].setPenColor(1201033);annotations[0].setPenStyle(PenStyleEnum.SOLID);annotations[0].setPenWidth(1);annotations[0].setOpacity(0.7);annotations[0].setType(TypeEnum.DISTANCE);annotations[0].setText("This is distance annotation");annotations[0].setCreatorName("Anonym A.");annotations[1]=newAnnotationInfo();annotations[1].setAnnotationPosition(pt);annotations[1].setBox(r);annotations[1].setPageNumber(2);annotations[1].setPenColor(1201033);annotations[1].setPenStyle(PenStyleEnum.SOLID);annotations[1].setPenWidth(1);annotations[0].setOpacity(0.7);annotations[1].setType(TypeEnum.AREA);annotations[1].setText("This is area annotation");annotations[1].setCreatorName("Anonym A.");annotations[2]=newAnnotationInfo();annotations[2].setAnnotationPosition(pt);annotations[2].setBox(r);annotations[2].setPageNumber(4);annotations[0].setOpacity(0.7);annotations[2].setType(TypeEnum.POINT);annotations[0].setText("This is point annotation");annotations[2].setCreatorName("Anonym A.");annotations[3]=newAnnotationInfo();annotations[3].setAnnotationPosition(pt);annotations[3].setBox(r);annotations[3].setPageNumber(5);annotations[3].setPenColor(1201033);annotations[3].setPenStyle(PenStyleEnum.SOLID);annotations[3].setPenWidth(1);annotations[0].setOpacity(0.7);annotations[3].setType(TypeEnum.ARROW);annotations[0].setText("This is arrow annotation");annotations[3].setCreatorName("Anonym A.");// Create request object.
FileInfofileInfo=newFileInfo();fileInfo.setFilePath("Annotationdocs\\ten-pages.docx");AnnotateOptionsoptions=newAnnotateOptions();options.setFileInfo(fileInfo);options.setAnnotations(Arrays.asList(annotations));options.setOutputPath("Output/ten-pages-annotated.docx");AnnotateRequestrequest=newAnnotateRequest(options);// Executing api method.
AnnotationApiLinkresult=apiInstance.annotate(request);System.out.println("AddMultipleAnnotations: Multiple Annotation added: "+result.getTitle());
// For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-php-samples
useGroupDocs\Annotation\Model;useGroupDocs\Annotation\Model\Requests;$AppSid="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$AppKey="";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$configuration=newGroupDocs\Annotation\Configuration();$configuration->setAppSid($AppSid);$configuration->setAppKey($AppKey);$apiInstance=newGroupDocs\Annotation\AnnotateApi($configuration);$a=newGroupDocs\Annotation\Model\AnnotationInfo();$pt=newGroupDocs\Annotation\Model\Point();$pt->setX(1);$pt->setY(1);$a->setAnnotationPosition($pt);$box=newGroupDocs\Annotation\Model\Rectangle();$box->setX(100);$box->setY(100);$box->setWidth(200);$box->setHeight(100);$a->setBox($box);$a->setPageNumber(0);$a->setPenColor(1201033);$a->setPenStyle(GroupDocs\Annotation\Model\AnnotationInfo::PEN_STYLE_SOLID);$a->setPenWidth(1);$a->setOpacity(0.7);$a->setType(GroupDocs\Annotation\Model\AnnotationInfo::TYPE_DISTANCE);$a->setText("This is distance annotation");$a->setCreatorName("Anonym A.");$a1=newGroupDocs\Annotation\Model\AnnotationInfo();$pt=newGroupDocs\Annotation\Model\Point();$pt->setX(1);$pt->setY(1);$a1->setAnnotationPosition($pt);$box=newGroupDocs\Annotation\Model\Rectangle();$box->setX(100);$box->setY(100);$box->setWidth(200);$box->setHeight(100);$a1->setBox($box);$a1->setPageNumber(2);$a1->setPenColor(1201033);$a1->setPenStyle(0);$a1->setPenWidth(1);$a1->setOpacity(0.7);$a1->setType(GroupDocs\Annotation\Model\AnnotationInfo::TYPE_AREA);$a1->setText("This is area annotation");$a1->setCreatorName("Anonym A.");$a2=newGroupDocs\Annotation\Model\AnnotationInfo();$pt=newGroupDocs\Annotation\Model\Point();$pt->setX(1);$pt->setY(1);$a2->setAnnotationPosition($pt);$box=newGroupDocs\Annotation\Model\Rectangle();$box->setX(100);$box->setY(100);$box->setWidth(200);$box->setHeight(100);$a2->setBox($box);$a2->setPageNumber(4);$a2->setOpacity(0.7);$a2->setType(GroupDocs\Annotation\Model\AnnotationInfo::TYPE_POINT);$a2->setText("This is point annotation");$a2->setCreatorName("Anonym A.");$a3=newGroupDocs\Annotation\Model\AnnotationInfo();$pt=newGroupDocs\Annotation\Model\Point();$pt->setX(1);$pt->setY(1);$a3->setAnnotationPosition($pt);$box=newGroupDocs\Annotation\Model\Rectangle();$box->setX(100);$box->setY(100);$box->setWidth(200);$box->setHeight(100);$a3->setBox($box);$a1->setPageNumber(5);$a1->setPenColor(1201033);$a1->setPenStyle(0);$a1->setPenWidth(1);$a3->setOpacity(0.7);$a3->setType(GroupDocs\Annotation\Model\AnnotationInfo::TYPE_ARROW);$a3->setText("This is arrow annotation");$a3->setCreatorName("Anonym A.");$fileInfo=newGroupDocs\Annotation\Model\FileInfo();$fileInfo->setFilePath("annotationdocs\\ten-pages.docx");$options=newGroupDocs\Annotation\Model\AnnotateOptions();$options->setFileInfo($fileInfo);$options->setAnnotations([$a,$a1,$a2,$a3]);$options->setOutputPath("Output\\output.docx");$request=newGroupDocs\Annotation\Model\Requests\annotateRequest($options);$result=$apiInstance->annotate($request);echo"AddMultipleAnnotations: Multiple Annotations added.";
// For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-node-samples
global.annotation_cloud=require("groupdocs-annotation-cloud");global.appSid="XXXX-XXXX-XXXX-XXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.appKey="XXXXXXXXXXXXXXXX";// Get AppKey and AppSID from https://dashboard.groupdocs.cloud
global.annotateApi=annotation_cloud.AnnotateApi.fromKeys(appSid,appKey);leta1=newannotation_cloud.AnnotationInfo();a1.annotationPosition=newannotation_cloud.Point();a1.annotationPosition.x=1;a1.annotationPosition.y=1;a1.box=newannotation_cloud.Rectangle();a1.box.x=100;a1.box.y=100;a1.box.width=200;a1.box.height=100;a1.pageNumber=0;a1.penColor=1201033;a1.penStyle=annotation_cloud.AnnotationInfo.PenStyleEnum.Solid;a1.penWidth=1;a1.type=annotation_cloud.AnnotationInfo.TypeEnum.Distance;a1.text="This is distance annotation";a1.creatorName="Anonym A.";leta2=newannotation_cloud.AnnotationInfo();a2.annotationPosition=newannotation_cloud.Point();a2.annotationPosition.x=1;a2.annotationPosition.y=1;a2.box=newannotation_cloud.Rectangle();a2.box.x=100;a2.box.y=100;a2.box.width=200;a2.box.height=100;a2.pageNumber=2;a2.penColor=1201033;a2.penStyle=annotation_cloud.AnnotationInfo.PenStyleEnum.Solid;a1.pageNumber=2;a2.penWidth=1;a2.type=annotation_cloud.AnnotationInfo.TypeEnum.Area;a1.text="This is area annotation";a2.creatorName="Anonym A.";leta3=newannotation_cloud.AnnotationInfo();a3.annotationPosition=newannotation_cloud.Point();a3.annotationPosition.x=1;a3.annotationPosition.y=1;a3.box=newannotation_cloud.Rectangle();a3.box.x=100;a3.box.y=100;a3.box.width=200;a3.box.height=100;a3.pageNumber=4;a3.type=annotation_cloud.AnnotationInfo.TypeEnum.Point;a1.text="This is point annotation";a3.creatorName="Anonym A.";leta4=newannotation_cloud.AnnotationInfo();a4.annotationPosition=newannotation_cloud.Point();a4.annotationPosition.x=1;a4.annotationPosition.y=1;a4.box=newannotation_cloud.Rectangle();a4.box.x=100;a4.box.y=100;a4.box.width=200;a4.box.height=100;a4.pageNumber=5;a4.penColor=1201033;a2.penStyle=annotation_cloud.AnnotationInfo.PenStyleEnum.Solid;a4.penWidth=1;a4.type=annotation_cloud.AnnotationInfo.TypeEnum.Arrow;a1.text="This is arrow annotation";a4.creatorName="Anonym A.";letfileInfo=newannotation_cloud.FileInfo();fileInfo.filePath="annotationdocs\\ten-pages.docx";letoptions=newannotation_cloud.AnnotateOptions();options.fileInfo=fileInfo;options.annotations=[a1,a2,a3,a4];options.outputPath="Output/output.docx";letresult=awaitannotateApi.annotate(newannotation_cloud.AnnotateRequest(options));console.log("AddMultipleAnnotations: Multiple Annotations added.");
# For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-python-samplesimportgroupdocs_annotation_cloudapp_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloudapp_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloudapi=groupdocs_annotation_cloud.AnnotateApi.from_keys(app_sid,app_key)a1=groupdocs_annotation_cloud.AnnotationInfo()a1.annotation_position=groupdocs_annotation_cloud.Point()a1.annotation_position.x=1a1.annotation_position.y=1a1.box=groupdocs_annotation_cloud.Rectangle()a1.box.x=100a1.box.y=100a1.box.width=200a1.box.height=100a1.page_number=0a1.pen_color=1201033a1.pen_style="Solid"a1.pen_width=1a1.opacity=0.7a1.type="Distance"a1.text="This is distance annotation"a1.creator_name="Anonym A."a2=groupdocs_annotation_cloud.AnnotationInfo()a2.annotation_position=groupdocs_annotation_cloud.Point()a2.annotation_position.x=1a2.annotation_position.y=1a2.box=groupdocs_annotation_cloud.Rectangle()a2.box.x=100a2.box.y=100a2.box.width=200a2.box.height=100a2.page_number=2a2.pen_color=1201033a2.pen_style="Solid"a2.pen_width=1a2.opacity=0.7a2.type="Area"a2.text="This is area annotation"a2.creator_name="Anonym A."a3=groupdocs_annotation_cloud.AnnotationInfo()a3.annotation_position=groupdocs_annotation_cloud.Point()a3.annotation_position.x=1a3.annotation_position.y=1a3.box=groupdocs_annotation_cloud.Rectangle()a3.box.x=100a3.box.y=100a3.box.width=200a3.box.height=100a3.page_number=4a3.opacity=0.7a3.type="Point"a3.text="This is point annotation"a3.creator_name="Anonym A."a4=groupdocs_annotation_cloud.AnnotationInfo()a4.annotation_position=groupdocs_annotation_cloud.Point()a4.annotation_position.x=1a4.annotation_position.y=1a4.box=groupdocs_annotation_cloud.Rectangle()a4.box.x=100a4.box.y=100a4.box.width=200a4.box.height=100a4.page_number=5a4.pen_color=1201033a4.pen_style="Solid"a4.pen_width=1a4.opacity=0.7a4.type="Arrow"a4.text="This is arrow annotation"a4.creator_name="Anonym A."file_info=FileInfo()file_info.file_path="annotationdocs\\ten-pages.docx"options=AnnotateOptions()options.file_info=file_infooptions.annotations=[a1,a2,a3,a4]options.output_path="Output\\output.docx"request=AnnotateRequest(options)result=api.annotate(request)print("AddMultipleAnnotations: Multiple Annotations added: "+result['href'])
# For complete examples and data files, please go to https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-ruby-samplesrequire'groupdocs_annotation_cloud'$app_sid="XXXX-XXXX-XXXX-XXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloud$app_key="XXXXXXXXXXXXXXXX"# Get AppKey and AppSID from https://dashboard.groupdocs.cloud$api=GroupDocsAnnotationCloud::AnnotateApi.from_keys($app_sid,$app_key)$a1=GroupDocsAnnotationCloud::AnnotationInfo.new$a1.annotation_position=GroupDocsAnnotationCloud::Point.new$a1.annotation_position.x=1$a1.annotation_position.y=1$a1.box=GroupDocsAnnotationCloud::Rectangle.new$a1.box.x=100$a1.box.y=100$a1.box.width=200$a1.box.height=100$a1.page_number=0$a1.pen_color=1201033$a1.pen_style="Solid"$a1.pen_width=1$a1.opacity=0.7$a1.type="Distance"$a1.text="This is distance annotation"$a1.creator_name="Anonym A."$a2=GroupDocsAnnotationCloud::AnnotationInfo.new$a2.annotation_position=GroupDocsAnnotationCloud::Point.new$a2.annotation_position.x=1$a2.annotation_position.y=1$a2.box=GroupDocsAnnotationCloud::Rectangle.new$a2.box.x=100$a2.box.y=100$a2.box.width=200$a2.box.height=100$a2.page_number=2$a2.pen_color=1201033$a2.pen_style="Solid"$a2.pen_width=1$a2.opacity=0.7$a2.type="Area"$a2.text="This is area annotation"$a2.creator_name="Anonym A."$a3=GroupDocsAnnotationCloud::AnnotationInfo.new$a3.annotation_position=GroupDocsAnnotationCloud::Point.new$a3.annotation_position.x=1$a3.annotation_position.y=1$a3.box=GroupDocsAnnotationCloud::Rectangle.new$a3.box.x=100$a3.box.y=100$a3.box.width=200$a3.box.height=100$a3.page_number=4$a3.opacity=0.7$a3.type="Point"$a3.text="This is point annotation"$a3.creator_name="Anonym A."$a4=GroupDocsAnnotationCloud::AnnotationInfo.new$a4.annotation_position=GroupDocsAnnotationCloud::Point.new$a4.annotation_position.x=1$a4.annotation_position.y=1$a4.box=GroupDocsAnnotationCloud::Rectangle.new$a4.box.x=100$a4.box.y=100$a4.box.width=200$a4.box.height=100$a4.page_number=5$a4.pen_color=1201033$a4.pen_style="Solid"$a4.pen_width=1$a4.opacity=0.7$a4.type="Arrow"$a4.text="This is arrow annotation"$a4.creator_name="Anonym A."file_info=GroupDocsAnnotationCloud::FileInfo.new()file_info.file_path="annotationdocs\\ten-pages.docx"options=GroupDocsAnnotationCloud::AnnotateOptions.new()options.file_info=file_infooptions.annotations=[$a1,$a2,$a3,$a4]options.output_path="Output/output.docx"$request=GroupDocsAnnotationCloud::AnnotateRequest.new(options)# Executing an API.result=$api.annotate($request)puts("AddMultipleAnnotations: Multiple Annotations added: "+result.href)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.