Skip to content

Commit 5375d19

Browse files
committed
Code Snippet AI agent: improve cURL code examples
1 parent 5212678 commit 5375d19

65 files changed

Lines changed: 4281 additions & 1242 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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

Lines changed: 69 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,82 @@ Steps 1 and 3 are storage operations, please refer to this [File API document
2727
## cURL example
2828

2929
{{< tabs "example1">}}
30-
{{< tab "Request" >}}
30+
{{< tab "Linux/MacOS/Bash" >}}
3131
```bash
3232
# First get JSON Web Token
33-
# 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.
33+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
34+
# Place them in environment variables CLIENT_ID and CLIENT_SECRET.
3435
curl -v "https://api.groupdocs.cloud/connect/token" \
35-
-X POST \
36-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
37-
-H "Content-Type: application/x-www-form-urlencoded" \
38-
-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"
3940

4041
# cURL example to get document information
4142
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
42-
-X POST \
43-
-H "Content-Type: application/json" \
44-
-H "Accept: application/json" \
45-
-H "Authorization: Bearer <jwt token>"
46-
-d "{
47-
'FileInfo': {
48-
'FilePath': 'SampleFiles/sample.docx'
49-
},
50-
'ViewFormat': 'HTML',
51-
'Watermark': {
52-
'Text': 'This is a watermark'
53-
}
54-
}"
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": "SampleFiles/sample.docx"
50+
},
51+
"ViewFormat": "HTML",
52+
"Watermark": {
53+
"Text": "This is a watermark"
54+
}
55+
}'
56+
```
57+
{{< /tab >}}
58+
59+
{{< tab "Windows PowerShell" >}}
60+
```powershell
61+
# First get JSON Web Token
62+
# Ensure CLIENT_ID and CLIENT_SECRET are set as environment variables.
63+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
64+
-X POST `
65+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
66+
-H "Content-Type: application/x-www-form-urlencoded" `
67+
-H "Accept: application/json"
68+
69+
# cURL example to get document information
70+
curl.exe -v "https://api.groupdocs.cloud/v2.0/viewer/view" `
71+
-X POST `
72+
-H "Content-Type: application/json" `
73+
-H "Accept: application/json" `
74+
-H "Authorization: Bearer $env:JWT_TOKEN" `
75+
-d "{
76+
'FileInfo': {
77+
'FilePath': 'SampleFiles/sample.docx'
78+
},
79+
'ViewFormat': 'HTML',
80+
'Watermark': {
81+
'Text': 'This is a watermark'
82+
}
83+
}"
84+
```
85+
{{< /tab >}}
86+
87+
{{< tab "Windows CMD" >}}
88+
```cmd
89+
rem First get JSON Web Token
90+
rem Ensure CLIENT_ID and CLIENT_SECRET are set as environment variables.
91+
curl -v "https://api.groupdocs.cloud/connect/token" ^
92+
-X POST ^
93+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
94+
-H "Content-Type: application/x-www-form-urlencoded" ^
95+
-H "Accept: application/json"
96+
97+
rem cURL example to get document information
98+
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" ^
99+
-X POST ^
100+
-H "Content-Type: application/json" ^
101+
-H "Accept: application/json" ^
102+
-H "Authorization: Bearer %JWT_TOKEN%" ^
103+
-d "{\"FileInfo\":{\"FilePath\":\"SampleFiles/sample.docx\"},\"ViewFormat\":\"HTML\",\"Watermark\":{\"Text\":\"This is a watermark\"}}"
55104
```
56-
{{< /tab >}} {{< tab "Resonse" >}}
105+
{{< /tab >}} {{< tab "Response" >}}
57106
```json
58107
{
59108
"pages": [

content/viewer/developer-guide/advanced-usage/common-rendering-options/fliprotate-pages.md

Lines changed: 77 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,91 @@ Steps 1 and 3 are storage operations, please refer to this [File API document
3333
## cURL example
3434

3535
{{< tabs "example1">}}
36-
{{< tab "Request" >}}
36+
{{< tab "Linux/MacOS/Bash" >}}
3737
```bash
3838
# First get JSON Web Token
3939
# 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.
4040
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"
41+
-X POST \
42+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
43+
-H "Content-Type: application/x-www-form-urlencoded" \
44+
-H "Accept: application/json"
4545

4646
# cURL example to get document information
4747
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
48-
-X POST \
49-
-H "Content-Type: application/json" \
50-
-H "Accept: application/json" \
51-
-H "Authorization: Bearer <jwt token>"
52-
-d "{
53-
'FileInfo': {
54-
'FilePath': 'SampleFiles/sample.docx'
55-
},
56-
'ViewFormat': 'PDF',
57-
'RenderOptions': {
58-
'PageRotations': [
59-
{
60-
'PageNumber': 1,
61-
'RotationAngle': 'On90Degree'
62-
}
63-
]
64-
}
65-
}"
48+
-X POST \
49+
-H "Content-Type: application/json" \
50+
-H "Accept: application/json" \
51+
-H "Authorization: Bearer $JWT_TOKEN" \
52+
-d '{
53+
"FileInfo": {
54+
"FilePath": "SampleFiles/sample.docx"
55+
},
56+
"ViewFormat": "PDF",
57+
"RenderOptions": {
58+
"PageRotations": [
59+
{
60+
"PageNumber": 1,
61+
"RotationAngle": "On90Degree"
62+
}
63+
]
64+
}
65+
}'
66+
```
67+
{{< /tab >}}
68+
69+
{{< tab "Windows PowerShell" >}}
70+
```powershell
71+
# First get JSON Web Token
72+
# 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.
73+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
74+
-X POST `
75+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
76+
-H "Content-Type: application/x-www-form-urlencoded" `
77+
-H "Accept: application/json"
78+
79+
# cURL example to get document information
80+
curl.exe -v "https://api.groupdocs.cloud/v2.0/viewer/view" `
81+
-X POST `
82+
-H "Content-Type: application/json" `
83+
-H "Accept: application/json" `
84+
-H "Authorization: Bearer $env:JWT_TOKEN" `
85+
-d "{
86+
'FileInfo': {
87+
'FilePath': 'SampleFiles/sample.docx'
88+
},
89+
'ViewFormat': 'PDF',
90+
'RenderOptions': {
91+
'PageRotations': [
92+
{
93+
'PageNumber': 1,
94+
'RotationAngle': 'On90Degree'
95+
}
96+
]
97+
}
98+
}"
99+
```
100+
{{< /tab >}}
101+
102+
{{< tab "Windows CMD" >}}
103+
```cmd
104+
REM First get JSON Web Token
105+
REM 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.
106+
curl.exe -v "https://api.groupdocs.cloud/connect/token" ^
107+
-X POST ^
108+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
109+
-H "Content-Type: application/x-www-form-urlencoded" ^
110+
-H "Accept: application/json"
111+
112+
REM cURL example to get document information
113+
curl.exe -v "https://api.groupdocs.cloud/v2.0/viewer/view" ^
114+
-X POST ^
115+
-H "Content-Type: application/json" ^
116+
-H "Accept: application/json" ^
117+
-H "Authorization: Bearer %JWT_TOKEN%" ^
118+
-d "{\"FileInfo\":{\"FilePath\":\"SampleFiles/sample.docx\"},\"ViewFormat\":\"PDF\",\"RenderOptions\":{\"PageRotations\":[{\"PageNumber\":1,\"RotationAngle\":\"On90Degree\"}]}}"
66119
```
67-
{{< /tab >}} {{< tab "Resonse" >}}
120+
{{< /tab >}} {{< tab "Response" >}}
68121
```json
69122
{
70123
"pages": null,

content/viewer/developer-guide/advanced-usage/common-rendering-options/render-document-with-comments.md

Lines changed: 67 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,78 @@ Steps 1 and 3 are storage operations, please refer to this [File API document
3535
## cURL example
3636

3737
{{< tabs "example1">}}
38-
{{< tab "Request" >}}
38+
{{< tab "Linux/MacOS/Bash" >}}
3939
```bash
40-
# 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.
40+
# Get JSON Web Token
4241
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"
42+
-X POST \
43+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
44+
-H "Content-Type: application/x-www-form-urlencoded" \
45+
-H "Accept: application/json"
4746

48-
# cURL example to get document information
47+
# Get document information
4948
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" \
50-
-X POST \
51-
-H "Content-Type: application/json" \
52-
-H "Accept: application/json" \
53-
-H "Authorization: Bearer <jwt token>"
54-
-d "{
55-
'FileInfo': {
56-
'FilePath': 'SampleFiles/with_comment.docx'
57-
},
58-
'ViewFormat': 'HTML',
59-
'RenderOptions': {
60-
'RenderComments': true
61-
}
62-
}"
49+
-X POST \
50+
-H "Content-Type: application/json" \
51+
-H "Accept: application/json" \
52+
-H "Authorization: Bearer $JWT_TOKEN" \
53+
-d '{
54+
"FileInfo": {
55+
"FilePath": "SampleFiles/with_comment.docx"
56+
},
57+
"ViewFormat": "HTML",
58+
"RenderOptions": {
59+
"RenderComments": true
60+
}
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+
# Get document information
75+
curl.exe -v "https://api.groupdocs.cloud/v2.0/viewer/view" `
76+
-X POST `
77+
-H "Content-Type: application/json" `
78+
-H "Accept: application/json" `
79+
-H "Authorization: Bearer $env:JWT_TOKEN" `
80+
-d "{
81+
'FileInfo': {
82+
'FilePath': 'SampleFiles/with_comment.docx'
83+
},
84+
'ViewFormat': 'HTML',
85+
'RenderOptions': {
86+
'RenderComments': true
87+
}
88+
}"
89+
```
90+
{{< /tab >}}
91+
92+
{{< tab "Windows CMD" >}}
93+
```cmd
94+
rem Get JSON Web Token
95+
curl -v "https://api.groupdocs.cloud/connect/token" ^
96+
-X POST ^
97+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
98+
-H "Content-Type: application/x-www-form-urlencoded" ^
99+
-H "Accept: application/json"
100+
101+
rem Get document information
102+
curl -v "https://api.groupdocs.cloud/v2.0/viewer/view" ^
103+
-X POST ^
104+
-H "Content-Type: application/json" ^
105+
-H "Accept: application/json" ^
106+
-H "Authorization: Bearer %JWT_TOKEN%" ^
107+
-d "{\"FileInfo\":{\"FilePath\":\"SampleFiles/with_comment.docx\"},\"ViewFormat\":\"HTML\",\"RenderOptions\":{\"RenderComments\":true}}"
63108
```
64-
{{< /tab >}} {{< tab "Resonse" >}}
109+
{{< /tab >}} {{< tab "Response" >}}
65110
```json
66111
{
67112
"pages": [

0 commit comments

Comments
 (0)