@@ -27,67 +27,145 @@ HTTP POST ~/annotation/add
2727## cURL example
2828
2929{{< tabs "example1">}}
30- {{< tab "Request" >}}
31-
32- ``` javascript
33- // First get JSON Web Token
34- // Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in the "client_id" and Client Secret in the "client_secret" arguments.
30+ {{< tab "Linux/MacOS/Bash" >}}
31+ ``` bash
32+ # Get JSON Web Token
33+ # Place your client credentials in the environment variables CLIENT_ID and CLIENT_SECRET.
3534curl -v " https://api.groupdocs.cloud/connect/token" \
36- - X POST \
37- - d " grant_type=client_credentials&client_id=xxxx &client_secret=xxxx " \
38- - H " Content-Type: application/x-www-form-urlencoded" \
39- - H " Accept: application/json"
35+ -X POST \
36+ -d " grant_type=client_credentials&client_id=$CLIENT_ID &client_secret=$CLIENT_SECRET " \
37+ -H " Content-Type: application/x-www-form-urlencoded" \
38+ -H " Accept: application/json"
4039
41- // cURL example to add annotation into document
40+ # Add annotation to a document
41+ # JWT token must be stored in the environment variable JWT_TOKEN.
4242curl -v " https://api.groupdocs.cloud/v2.0/annotation/add" \
43- - X POST \
44- - H " Content-Type: application/json" \
45- - H " Accept: application/json" \
46- - H " Authorization: Bearer <jwt token>" \
47- - d "
48- {
49- 'FileInfo': {
50- 'FilePath': 'annotationdocs/one-page.docx'
51- },
52- 'OutputPath': " Output/ output .docx " ,
53- 'Annotations': [
54- {
55- 'Type': 'Arrow',
56- 'Text': 'This is arrow annotation',
57- 'CreatorName': 'Anonym A.',
58- 'Box': {
59- 'X': 100,
60- 'Y': 100,
61- 'Width': 100,
62- 'Height': 100
43+ -X POST \
44+ -H " Content-Type: application/json" \
45+ -H " Accept: application/json" \
46+ -H " Authorization: Bearer $JWT_TOKEN " \
47+ -d ' {
48+ "FileInfo": {
49+ "FilePath": "annotationdocs/one-page.docx"
6350 },
64- 'PageNumber': 0,
65- 'AnnotationPosition': {
66- 'X': 1,
67- 'Y': 1
68- },
69- 'Replies': [
51+ "OutputPath": "Output/output.docx",
52+ "Annotations": [
7053 {
71- 'Comment': 'First comment',
72- 'RepliedOn': '2020-10-02T06:52:01.376Z'
73- },
54+ "Type": "Arrow",
55+ "Text": "This is arrow annotation",
56+ "CreatorName": "Anonym A.",
57+ "Box": {
58+ "X": 100,
59+ "Y": 100,
60+ "Width": 100,
61+ "Height": 100
62+ },
63+ "PageNumber": 0,
64+ "AnnotationPosition": {
65+ "X": 1,
66+ "Y": 1
67+ },
68+ "Replies": [
69+ {
70+ "Comment": "First comment",
71+ "RepliedOn": "2020-10-02T06:52:01.376Z"
72+ },
73+ {
74+ "Comment": "Second comment",
75+ "RepliedOn": "2020-10-02T06:52:01.376Z"
76+ }
77+ ],
78+ "CreatedOn": "2020-10-02T06:52:01.376Z",
79+ "PenStyle": "Solid",
80+ "PenColor": 65535,
81+ "PenWidth": 3,
82+ "BackgroundColor": 65535,
83+ "Opacity": 0.7
84+ }
85+ ]
86+ }'
87+ ```
88+ {{< /tab >}}
89+
90+ {{< tab "Windows PowerShell" >}}
91+ ``` powershell
92+ # Get JSON Web Token
93+ # Store your client credentials in environment variables CLIENT_ID and CLIENT_SECRET.
94+ curl.exe -v "https://api.groupdocs.cloud/connect/token" `
95+ -X POST `
96+ -d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
97+ -H "Content-Type: application/x-www-form-urlencoded" `
98+ -H "Accept: application/json"
99+
100+ # Add annotation to a document
101+ # JWT token must be stored in the environment variable JWT_TOKEN.
102+ curl.exe -v "https://api.groupdocs.cloud/v2.0/annotation/add" `
103+ -X POST `
104+ -H "Content-Type: application/json" `
105+ -H "Accept: application/json" `
106+ -H "Authorization: Bearer $env:JWT_TOKEN" `
107+ -d "{
108+ 'FileInfo': {
109+ 'FilePath': 'annotationdocs/one-page.docx'
110+ },
111+ 'OutputPath': 'Output/output.docx',
112+ 'Annotations': [
74113 {
75- 'Comment': 'Second comment',
76- 'RepliedOn': '2020-10-02T06:52:01.376Z'
114+ 'Type': 'Arrow',
115+ 'Text': 'This is arrow annotation',
116+ 'CreatorName': 'Anonym A.',
117+ 'Box': {
118+ 'X': 100,
119+ 'Y': 100,
120+ 'Width': 100,
121+ 'Height': 100
122+ },
123+ 'PageNumber': 0,
124+ 'AnnotationPosition': {
125+ 'X': 1,
126+ 'Y': 1
127+ },
128+ 'Replies': [
129+ {
130+ 'Comment': 'First comment',
131+ 'RepliedOn': '2020-10-02T06:52:01.376Z'
132+ },
133+ {
134+ 'Comment': 'Second comment',
135+ 'RepliedOn': '2020-10-02T06:52:01.376Z'
136+ }
137+ ],
138+ 'CreatedOn': '2020-10-02T06:52:01.376Z',
139+ 'PenStyle': 'Solid',
140+ 'PenColor': 65535,
141+ 'PenWidth': 3,
142+ 'BackgroundColor': 65535,
143+ 'Opacity': 0.7
77144 }
78- ],
79- 'CreatedOn': '2020-10-02T06:52:01.376Z',
80- 'PenStyle': 'Solid',
81- 'PenColor': 65535,
82- 'PenWidth': 3,
83- 'BackgroundColor': 65535,
84- 'Opacity': 0.7
85- }
86- ]
87- }
88- "
145+ ]
146+ }"
89147```
148+ {{< /tab >}}
149+
150+ {{< tab "Windows CMD" >}}
151+ ``` cmd
152+ :: Get JSON Web Token
153+ :: Store your client credentials in environment variables CLIENT_ID and CLIENT_SECRET.
154+ curl -v "https://api.groupdocs.cloud/connect/token" ^
155+ -X POST ^
156+ -d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
157+ -H "Content-Type: application/x-www-form-urlencoded" ^
158+ -H "Accept: application/json"
90159
160+ :: Add annotation to a document
161+ :: JWT token must be stored in the environment variable JWT_TOKEN.
162+ curl -v "https://api.groupdocs.cloud/v2.0/annotation/add" ^
163+ -X POST ^
164+ -H "Content-Type: application/json" ^
165+ -H "Accept: application/json" ^
166+ -H "Authorization: Bearer %JWT_TOKEN%" ^
167+ -d "{\"FileInfo\":{\"FilePath\":\"annotationdocs/one-page.docx\"},\"OutputPath\":\"Output/output.docx\",\"Annotations\":[{\"Type\":\"Arrow\",\"Text\":\"This is arrow annotation\",\"CreatorName\":\"Anonym A.\",\"Box\":{\"X\":100,\"Y\":100,\"Width\":100,\"Height\":100},\"PageNumber\":0,\"AnnotationPosition\":{\"X\":1,\"Y\":1},\"Replies\":[{\"Comment\":\"First comment\",\"RepliedOn\":\"2020-10-02T06:52:01.376Z\"},{\"Comment\":\"Second comment\",\"RepliedOn\":\"2020-10-02T06:52:01.376Z\"}],\"CreatedOn\":\"2020-10-02T06:52:01.376Z\",\"PenStyle\":\"Solid\",\"PenColor\":65535,\"PenWidth\":3,\"BackgroundColor\":65535,\"Opacity\":0.7}]}"
168+ ```
91169{{< /tab >}}
92170{{< tab "Response" >}}
93171
0 commit comments