Skip to content

Commit 9e5e058

Browse files
committed
Code Snippet AI agent - improve cUrl code snippets
1 parent e15f191 commit 9e5e058

34 files changed

Lines changed: 2908 additions & 588 deletions

content/conversion/developer-guide/advanced-usage/async-conversion/convert-document-direct.md

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,68 @@ This example demonstrates how to convert word processing document into pdf docum
2222

2323
## cURL example
2424

25-
{{< tabs "example1">}} {{< tab "Request" >}}
25+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
2626

2727
```bash
28-
// First get JSON Web Token
29-
// Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
28+
# First get JSON Web Token
29+
# Place your Client Id and Client Secret in environment variables CLIENT_ID and CLIENT_SECRET.
3030
curl -v "https://api.groupdocs.cloud/connect/token" \
31-
-X POST \
32-
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
33-
-H "Content-Type: application/x-www-form-urlencoded" \
34-
-H "Accept: application/json"
31+
-X POST \
32+
-d 'grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET' \
33+
-H "Content-Type: application/x-www-form-urlencoded" \
34+
-H "Accept: application/json"
3535

36-
// cURL example to convert document
36+
# cURL example to convert document asynchronously
3737
curl -v "https://api.groupdocs.cloud/v2.0/conversion/async" \
38-
-X PUT \
39-
-H "Content-Type: application/json" \
40-
-H "Accept: application/json" \
41-
-H "Authorization: Bearer <jwt token>"
42-
--data-binary "@path/to/file"
38+
-X PUT \
39+
-H "Content-Type: application/json" \
40+
-H "Accept: application/json" \
41+
-H "Authorization: Bearer $JWT_TOKEN" \
42+
--data-binary "@path/to/file"
43+
```
44+
45+
{{< /tab >}}
46+
47+
{{< tab "Windows PowerShell" >}}
48+
49+
```powershell
50+
# First get JSON Web Token
51+
# Place your Client Id and Client Secret in environment variables CLIENT_ID and CLIENT_SECRET.
52+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
53+
-X POST `
54+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
55+
-H "Content-Type: application/x-www-form-urlencoded" `
56+
-H "Accept: application/json"
57+
58+
# cURL example to convert document asynchronously
59+
curl.exe -v "https://api.groupdocs.cloud/v2.0/conversion/async" `
60+
-X PUT `
61+
-H "Content-Type: application/json" `
62+
-H "Accept: application/json" `
63+
-H "Authorization: Bearer $env:JWT_TOKEN" `
64+
--data-binary "@path/to/file"
65+
```
66+
67+
{{< /tab >}}
68+
69+
{{< tab "Windows CMD" >}}
70+
71+
```cmd
72+
rem First get JSON Web Token
73+
rem Place your Client Id and Client Secret in environment variables CLIENT_ID and CLIENT_SECRET.
74+
curl -v "https://api.groupdocs.cloud/connect/token" ^
75+
-X POST ^
76+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
77+
-H "Content-Type: application/x-www-form-urlencoded" ^
78+
-H "Accept: application/json"
79+
80+
rem cURL example to convert document asynchronously
81+
curl -v "https://api.groupdocs.cloud/v2.0/conversion/async" ^
82+
-X PUT ^
83+
-H "Content-Type: application/json" ^
84+
-H "Accept: application/json" ^
85+
-H "Authorization: Bearer %JWT_TOKEN%" ^
86+
--data-binary "@path/to/file"
4387
```
4488

4589
{{< /tab >}} {{< tab "Response" >}}

content/conversion/developer-guide/advanced-usage/async-conversion/convert-document.md

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,72 @@ Steps 1 and 4 are storage operations, please refer to this  for usage detail
2525

2626
## cURL example
2727

28-
{{< tabs "example1">}} {{< tab "Request" >}}
29-
28+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
3029
```bash
31-
// First get JSON Web Token
32-
// Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
30+
# First get JSON Web Token
31+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
3332
curl -v "https://api.groupdocs.cloud/connect/token" \
34-
-X POST \
35-
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
36-
-H "Content-Type: application/x-www-form-urlencoded" \
37-
-H "Accept: application/json"
38-
39-
// cURL example to convert document
40-
curl -v "https://api.groupdocs.cloud/v2.0/conversion/async" \
41-
-X POST \
42-
-H "Content-Type: application/json" \
43-
-H "Accept: application/json" \
44-
-H "Authorization: Bearer <jwt token>"
45-
-d "{
33+
-X POST \
34+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
35+
-H "Content-Type: application/x-www-form-urlencoded" \
36+
-H "Accept: application/json"
37+
38+
# Convert document
39+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
40+
-X POST \
41+
-H "Content-Type: application/json" \
42+
-H "Accept: application/json" \
43+
-H "Authorization: Bearer $JWT_TOKEN" \
44+
-d '{
45+
"FilePath": "WordProcessing/four-pages.docx",
46+
"Format": "pdf",
47+
"OutputPath": "Output"
48+
}'
49+
```
50+
{{< /tab >}}
51+
52+
{{< tab "Windows PowerShell" >}}
53+
```powershell
54+
# First get JSON Web Token
55+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
56+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
57+
-X POST `
58+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
59+
-H "Content-Type: application/x-www-form-urlencoded" `
60+
-H "Accept: application/json"
61+
62+
# Convert document
63+
curl.exe -v "https://api.groupdocs.cloud/v2.0/conversion" `
64+
-X POST `
65+
-H "Content-Type: application/json" `
66+
-H "Accept: application/json" `
67+
-H "Authorization: Bearer $env:JWT_TOKEN" `
68+
-d "{
4669
'FilePath': 'WordProcessing/four-pages.docx',
4770
'Format': 'pdf',
4871
'OutputPath': 'Output'
49-
}"
72+
}"
73+
```
74+
{{< /tab >}}
75+
76+
{{< tab "Windows CMD" >}}
77+
```cmd
78+
:: First get JSON Web Token
79+
:: Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
80+
curl -v "https://api.groupdocs.cloud/connect/token" ^
81+
-X POST ^
82+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
83+
-H "Content-Type: application/x-www-form-urlencoded" ^
84+
-H "Accept: application/json"
85+
86+
:: Convert document
87+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" ^
88+
-X POST ^
89+
-H "Content-Type: application/json" ^
90+
-H "Accept: application/json" ^
91+
-H "Authorization: Bearer %JWT_TOKEN%" ^
92+
-d "{\"FilePath\":\"WordProcessing/four-pages.docx\",\"Format\":\"pdf\",\"OutputPath\":\"Output\"}"
5093
```
51-
5294
{{< /tab >}} {{< tab "Response" >}}
5395

5496
```json

content/conversion/developer-guide/advanced-usage/common-conversion-options/add-watermark.md

Lines changed: 74 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,83 @@ Step 3 is not needed if the "OutputPath" option is not provided: the convert API
3232

3333
## cURL example
3434

35-
{{< tabs "example1">}} {{< tab "Request" >}}
36-
35+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
3736
```bash
38-
// First get JSON Web Token
39-
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
37+
# Get JSON Web Token
4038
curl -v "https://api.groupdocs.cloud/connect/token" \
41-
-X POST \
42-
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
43-
-H "Content-Type: application/x-www-form-urlencoded" \
44-
-H "Accept: application/json"
45-
46-
# cURL example to convert document
47-
curl -v "https://api.groupdocs.cloud/v2.0/conversion/conversion" \
48-
-X POST \
49-
-H "Content-Type: application/json" \
50-
-H "Accept: application/json" \
51-
-H "Authorization: Bearer <jwt token>"
52-
-d "{
53-
'FilePath': 'WordProcessing/four-pages.docx',
54-
'Format': 'pdf',
55-
'WatermarkOptions': {
56-
'Text': 'Sample watermark',
57-
'Color': 'Red',
58-
'Width': 100,
59-
'Height': 100,
60-
'Background': true
61-
}
62-
'OutputPath': 'Output'
63-
}"
39+
-X POST \
40+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
41+
-H "Content-Type: application/x-www-form-urlencoded" \
42+
-H "Accept: application/json"
43+
44+
# Convert document
45+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
46+
-X POST \
47+
-H "Content-Type: application/json" \
48+
-H "Accept: application/json" \
49+
-H "Authorization: Bearer $JWT_TOKEN" \
50+
-d '{
51+
"FilePath": "WordProcessing/four-pages.docx",
52+
"Format": "pdf",
53+
"WatermarkOptions": {
54+
"Text": "Sample watermark",
55+
"Color": "Red",
56+
"Width": 100,
57+
"Height": 100,
58+
"Background": true
59+
},
60+
"OutputPath": "Output"
61+
}'
62+
```
63+
{{< /tab >}}
64+
65+
{{< tab "Windows PowerShell" >}}
66+
```powershell
67+
# Get JSON Web Token
68+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
69+
-X POST `
70+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
71+
-H "Content-Type: application/x-www-form-urlencoded" `
72+
-H "Accept: application/json"
73+
74+
# Convert document
75+
curl.exe -v "https://api.groupdocs.cloud/v2.0/conversion" `
76+
-X POST `
77+
-H "Content-Type: application/json" `
78+
-H "Accept: application/json" `
79+
-H "Authorization: Bearer $env:JWT_TOKEN" `
80+
-d '{
81+
"FilePath": "WordProcessing/four-pages.docx",
82+
"Format": "pdf",
83+
"WatermarkOptions": {
84+
"Text": "Sample watermark",
85+
"Color": "Red",
86+
"Width": 100,
87+
"Height": 100,
88+
"Background": true
89+
},
90+
"OutputPath": "Output"
91+
}'
92+
```
93+
{{< /tab >}}
94+
95+
{{< tab "Windows CMD" >}}
96+
```cmd
97+
:: Get JSON Web Token
98+
curl -v "https://api.groupdocs.cloud/connect/token" ^
99+
-X POST ^
100+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
101+
-H "Content-Type: application/x-www-form-urlencoded" ^
102+
-H "Accept: application/json"
103+
104+
:: Convert document
105+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" ^
106+
-X POST ^
107+
-H "Content-Type: application/json" ^
108+
-H "Accept: application/json" ^
109+
-H "Authorization: Bearer %JWT_TOKEN%" ^
110+
-d "{\"FilePath\":\"WordProcessing/four-pages.docx\",\"Format\":\"pdf\",\"WatermarkOptions\":{\"Text\":\"Sample watermark\",\"Color\":\"Red\",\"Width\":100,\"Height\":100,\"Background\":true},\"OutputPath\":\"Output\"}"
64111
```
65-
66112
{{< /tab >}} {{< tab "Response" >}}
67113

68114
```json

content/conversion/developer-guide/advanced-usage/common-conversion-options/convert-n-consecutive-pages.md

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,54 @@ Step 3 is not needed if the "OutputPath" option is not provided: the convert API
3434

3535
## cURL example
3636

37-
{{< tabs "example1">}} {{< tab "Request" >}}
37+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
3838

3939
```bash
4040
# First get JSON Web Token
41-
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications. Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
41+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
4242
curl -v "https://api.groupdocs.cloud/connect/token" \
43-
-X POST \
44-
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
45-
-H "Content-Type: application/x-www-form-urlencoded" \
46-
-H "Accept: application/json"
43+
-X POST \
44+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
45+
-H "Content-Type: application/x-www-form-urlencoded" \
46+
-H "Accept: application/json"
4747

4848
# cURL example to convert document
49-
curl -v "https://api.groupdocs.cloud/v2.0/conversion/conversion" \
50-
-X POST \
51-
-H "Content-Type: application/json" \
52-
-H "Accept: application/json" \
53-
-H "Authorization: Bearer <jwt token>"
54-
-d "{
49+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
50+
-X POST \
51+
-H "Content-Type: application/json" \
52+
-H "Accept: application/json" \
53+
-H "Authorization: Bearer $JWT_TOKEN" \
54+
-d '{
55+
"FilePath": "WordProcessing/four-pages.docx",
56+
"Format": "pdf",
57+
"ConvertOptions": {
58+
"FromPage": 2,
59+
"PagesCount": 2
60+
},
61+
"OutputPath": "Output/two-pages.pdf"
62+
}'
63+
```
64+
65+
{{< /tab >}}
66+
67+
{{< tab "Windows PowerShell" >}}
68+
69+
```powershell
70+
# First get JSON Web Token
71+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
72+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
73+
-X POST `
74+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
75+
-H "Content-Type: application/x-www-form-urlencoded" `
76+
-H "Accept: application/json"
77+
78+
# cURL example to convert document
79+
curl.exe -v "https://api.groupdocs.cloud/v2.0/conversion" `
80+
-X POST `
81+
-H "Content-Type: application/json" `
82+
-H "Accept: application/json" `
83+
-H "Authorization: Bearer $env:JWT_TOKEN" `
84+
-d "{
5585
'FilePath': 'WordProcessing/four-pages.docx',
5686
'Format': 'pdf',
5787
'ConvertOptions': {
@@ -60,7 +90,28 @@ curl -v "https://api.groupdocs.cloud/v2.0/conversion/conversion" \
6090
},
6191
'OutputPath': 'Output/two-pages.pdf'
6292
}"
93+
```
6394

95+
{{< /tab >}}
96+
97+
{{< tab "Windows CMD" >}}
98+
99+
```cmd
100+
:: First get JSON Web Token
101+
:: Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
102+
curl -v "https://api.groupdocs.cloud/connect/token" ^
103+
-X POST ^
104+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
105+
-H "Content-Type: application/x-www-form-urlencoded" ^
106+
-H "Accept: application/json"
107+
108+
:: cURL example to convert document
109+
curl -v "https://api.groupdocs.cloud/v2.0/conversion" ^
110+
-X POST ^
111+
-H "Content-Type: application/json" ^
112+
-H "Accept: application/json" ^
113+
-H "Authorization: Bearer %JWT_TOKEN%" ^
114+
-d "{\"FilePath\":\"WordProcessing/four-pages.docx\",\"Format\":\"pdf\",\"ConvertOptions\":{\"FromPage\":2,\"PagesCount\":2},\"OutputPath\":\"Output/two-pages.pdf\"}"
64115
```
65116

66117
{{< /tab >}} {{< tab "Response" >}}

0 commit comments

Comments
 (0)