Skip to content

Commit 7633f55

Browse files
author
AI Agent
committed
Code Snippet AI agent - improve cUrl code snippets
1 parent 9b13996 commit 7633f55

27 files changed

Lines changed: 2590 additions & 965 deletions

content/annotation/developer-guide/advanced-usage/add-annotation/area-annotation.md

Lines changed: 129 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,65 +28,143 @@ HTTP POST ~/annotation/add
2828
## cURL example
2929

3030
{{< tabs "example1">}}
31-
{{< tab "Request" >}}
31+
{{< tab "Linux/MacOS/Bash" >}}
3232

33-
```javascript
34-
// First get JSON Web Token
35-
// 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.
33+
```bash
34+
# First get JSON Web Token
3635
curl -v "https://api.groupdocs.cloud/connect/token" \
37-
-X POST \
38-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
39-
-H "Content-Type: application/x-www-form-urlencoded" \
40-
-H "Accept: application/json"
36+
-X POST \
37+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
38+
-H "Content-Type: application/x-www-form-urlencoded" \
39+
-H "Accept: application/json"
4140

42-
// cURL example to add annotation into document
41+
# cURL example to add annotation into document
4342
curl -v "https://api.groupdocs.cloud/v2.0/annotation/add" \
44-
-X POST \
45-
-H "Content-Type: application/json" \
46-
-H "Accept: application/json" \
47-
-H "Authorization: Bearer <jwt token>" \
48-
-d "
49-
{
50-
'FileInfo': {
51-
'FilePath': 'annotationdocs/one-page.docx'
52-
},
53-
'OutputPath': "Output/output.docx",
54-
'Annotations': [
55-
{
56-
'Type': 'Area',
57-
'Text': 'This is area annotation',
58-
'CreatorName': 'Anonym A.',
59-
'Box': {
60-
'X': 100,
61-
'Y': 100,
62-
'Width': 100,
63-
'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"
6450
},
65-
'PageNumber': 0,
66-
'AnnotationPosition': {
67-
'X': 1,
68-
'Y': 1
69-
},
70-
'Replies': [
51+
"OutputPath": "Output/output.docx",
52+
"Annotations": [
7153
{
72-
'Comment': 'First comment',
73-
'RepliedOn': '2020-10-02T06:52:01.376Z'
74-
},
54+
"Type": "Area",
55+
"Text": "This is area 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+
89+
{{< /tab >}}
90+
91+
{{< tab "Windows PowerShell" >}}
92+
93+
```powershell
94+
# First get JSON Web Token
95+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
96+
-X POST `
97+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
98+
-H "Content-Type: application/x-www-form-urlencoded" `
99+
-H "Accept: application/json"
100+
101+
# cURL example to add annotation into document
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': [
75113
{
76-
'Comment': 'Second comment',
77-
'RepliedOn': '2020-10-02T06:52:01.376Z'
114+
'Type': 'Area',
115+
'Text': 'This is area 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
78144
}
79-
],
80-
'CreatedOn': '2020-10-02T06:52:01.376Z',
81-
'PenStyle': 'Solid',
82-
'PenColor': 65535,
83-
'PenWidth': 3,
84-
'BackgroundColor': 65535,
85-
'Opacity': 0.7
86-
}
87-
]
88-
}
89-
"
145+
]
146+
}"
147+
```
148+
149+
{{< /tab >}}
150+
151+
{{< tab "Windows CMD" >}}
152+
153+
```cmd
154+
:: First get JSON Web Token
155+
curl -v "https://api.groupdocs.cloud/connect/token" ^
156+
-X POST ^
157+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
158+
-H "Content-Type: application/x-www-form-urlencoded" ^
159+
-H "Accept: application/json"
160+
161+
:: cURL example to add annotation into document
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\":\"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},\"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}]}"
90168
```
91169

92170
{{< /tab >}}

content/annotation/developer-guide/advanced-usage/add-annotation/arrow-annotation.md

Lines changed: 130 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
3534
curl -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.
4242
curl -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

Comments
 (0)