Skip to content

Commit e1383ad

Browse files
author
AI Agent
committed
Code Snippet AI agent - improve cUrl code snippets
1 parent 28bbb80 commit e1383ad

11 files changed

+743
-156
lines changed

content/editor/developer-guide/document-edit-operations/working-with-dsv-documents.md

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,72 @@ HTTP POST ~/load
4949

5050
## cURL example
5151

52-
{{< tabs "example1">}} {{< tab "Request" >}}
52+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
5353

5454
```bash
55-
* First get JSON Web Token
56-
* 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.
55+
# First, get JSON Web Token
56+
# Replace CLIENT_ID and CLIENT_SECRET with your credentials
5757
curl -v "https://api.groupdocs.cloud/connect/token" \
58-
-X POST \
59-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
60-
-H "Content-Type: application/x-www-form-urlencoded" \
61-
-H "Accept: application/json"
58+
-X POST \
59+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
60+
-H "Content-Type: application/x-www-form-urlencoded" \
61+
-H "Accept: application/json"
6262

63-
* cURL example to load document
63+
# Load a document
6464
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \
65-
-X POST \
66-
-H "Content-Type: application/json" \
67-
-H "Accept: application/json" \
68-
-H "Authorization: Bearer
69-
<jwt token>"
70-
-d "{
65+
-X POST \
66+
-H "Content-Type: application/json" \
67+
-H "Accept: application/json" \
68+
-H "Authorization: Bearer $JWT_TOKEN" \
69+
-d '{
70+
"FileInfo": { "FilePath": "cells/sample.tsv" },
71+
"OutputPath": "Output"
72+
}'
73+
```
74+
75+
{{< /tab >}}
76+
77+
{{< tab "Windows PowerShell" >}}
78+
79+
```powershell
80+
# First, get JSON Web Token
81+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
82+
-X POST `
83+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
84+
-H "Content-Type: application/x-www-form-urlencoded" `
85+
-H "Accept: application/json"
86+
87+
# Load a document
88+
curl.exe -v "https://api.groupdocs.cloud/v1.0/editor/load" `
89+
-X POST `
90+
-H "Content-Type: application/json" `
91+
-H "Accept: application/json" `
92+
-H "Authorization: Bearer $env:JWT_TOKEN" `
93+
-d "{
7194
'FileInfo': { 'FilePath': 'cells/sample.tsv' },
72-
'OutputPath': 'Output'
73-
}"
95+
'OutputPath': 'Output'
96+
}"
97+
```
98+
99+
{{< /tab >}}
100+
101+
{{< tab "Windows CMD" >}}
102+
103+
```cmd
104+
:: First, get JSON Web Token
105+
curl -v "https://api.groupdocs.cloud/connect/token" ^
106+
-X POST ^
107+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
108+
-H "Content-Type: application/x-www-form-urlencoded" ^
109+
-H "Accept: application/json"
110+
111+
:: Load a document
112+
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" ^
113+
-X POST ^
114+
-H "Content-Type: application/json" ^
115+
-H "Accept: application/json" ^
116+
-H "Authorization: Bearer %JWT_TOKEN%" ^
117+
-d "{\"FileInfo\": { \"FilePath\": \"cells/sample.tsv\" }, \"OutputPath\": \"Output\"}"
74118
```
75119

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

content/editor/developer-guide/document-edit-operations/working-with-presentations.md

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,29 +47,79 @@ HTTP POST ~/load
4747

4848
## cURL example
4949

50-
{{< tabs "example1">}} {{< tab "Request" >}}
50+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
5151

5252
```bash
53-
* First get JSON Web Token
54-
* 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.
53+
# First get JSON Web Token
54+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
55+
# Place Client Id in $CLIENT_ID and Client Secret in $CLIENT_SECRET.
5556
curl -v "https://api.groupdocs.cloud/connect/token" \
56-
-X POST \
57-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
58-
-H "Content-Type: application/x-www-form-urlencoded" \
59-
-H "Accept: application/json"
57+
-X POST \
58+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
59+
-H "Content-Type: application/x-www-form-urlencoded" \
60+
-H "Accept: application/json"
6061

61-
* cURL example to load document
62+
# cURL example to load document
6263
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \
63-
-X POST \
64-
-H "Content-Type: application/json" \
65-
-H "Accept: application/json" \
66-
-H "Authorization: Bearer
67-
<jwt token>"
68-
-d "{
64+
-X POST \
65+
-H "Content-Type: application/json" \
66+
-H "Accept: application/json" \
67+
-H "Authorization: Bearer $JWT_TOKEN" \
68+
-d '{
69+
"FileInfo": { "FilePath": "Presentation/sample.pptx" },
70+
"OutputPath": "Output",
71+
"SlideNumber": 0
72+
}'
73+
```
74+
75+
{{< /tab >}}
76+
77+
{{< tab "Windows PowerShell" >}}
78+
79+
```powershell
80+
# First get JSON Web Token
81+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
82+
# Place Client Id in $env:CLIENT_ID and Client Secret in $env:CLIENT_SECRET.
83+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
84+
-X POST `
85+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
86+
-H "Content-Type: application/x-www-form-urlencoded" `
87+
-H "Accept: application/json"
88+
89+
# cURL example to load document
90+
curl.exe -v "https://api.groupdocs.cloud/v1.0/editor/load" `
91+
-X POST `
92+
-H "Content-Type: application/json" `
93+
-H "Accept: application/json" `
94+
-H "Authorization: Bearer $env:JWT_TOKEN" `
95+
-d "{
6996
'FileInfo': { 'FilePath': 'Presentation/sample.pptx' },
70-
'OutputPath': 'Output',
71-
'SlideNumber': 0
72-
}"
97+
'OutputPath': 'Output',
98+
'SlideNumber': 0
99+
}"
100+
```
101+
102+
{{< /tab >}}
103+
104+
{{< tab "Windows CMD" >}}
105+
106+
```cmd
107+
:: First get JSON Web Token
108+
:: Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
109+
:: Place Client Id in %CLIENT_ID% and Client Secret in %CLIENT_SECRET%.
110+
curl -v "https://api.groupdocs.cloud/connect/token" ^
111+
-X POST ^
112+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
113+
-H "Content-Type: application/x-www-form-urlencoded" ^
114+
-H "Accept: application/json"
115+
116+
:: cURL example to load document
117+
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" ^
118+
-X POST ^
119+
-H "Content-Type: application/json" ^
120+
-H "Accept: application/json" ^
121+
-H "Authorization: Bearer %JWT_TOKEN%" ^
122+
-d "{ \"FileInfo\": { \"FilePath\": \"Presentation/sample.pptx\" }, \"OutputPath\": \"Output\", \"SlideNumber\": 0 }"
73123
```
74124

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

content/editor/developer-guide/document-edit-operations/working-with-spreadsheets.md

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,75 @@ HTTP POST ~/load
4848

4949
## cURL example
5050

51-
{{< tabs "example1">}} {{< tab "Request" >}}
51+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
5252

5353
```bash
54-
* First get JSON Web Token
55-
* 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.
54+
# First get JSON Web Token
55+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
56+
# Place them in the environment variables CLIENT_ID and CLIENT_SECRET.
5657
curl -v "https://api.groupdocs.cloud/connect/token" \
57-
-X POST \
58-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
59-
-H "Content-Type: application/x-www-form-urlencoded" \
60-
-H "Accept: application/json"
58+
-X POST \
59+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
60+
-H "Content-Type: application/x-www-form-urlencoded" \
61+
-H "Accept: application/json"
6162

62-
* cURL example to load document
63+
# Load document
6364
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \
64-
-X POST \
65-
-H "Content-Type: application/json" \
66-
-H "Accept: application/json" \
67-
-H "Authorization: Bearer
68-
<jwt token>"
69-
-d "{
70-
'FileInfo': { 'FilePath': 'Spreadsheet/four-sheets.xlsx' },
71-
'OutputPath': 'Output',
72-
'WorksheetIndex': 0
73-
}"
65+
-X POST \
66+
-H "Content-Type: application/json" \
67+
-H "Accept: application/json" \
68+
-H "Authorization: Bearer $JWT_TOKEN" \
69+
-d '{
70+
"FileInfo": { "FilePath": "Spreadsheet/four-sheets.xlsx" },
71+
"OutputPath": "Output",
72+
"WorksheetIndex": 0
73+
}'
74+
```
75+
76+
{{< /tab >}}
77+
78+
{{< tab "Windows PowerShell" >}}
79+
80+
```powershell
81+
# First get JSON Web Token
82+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
83+
# Place them in the environment variables CLIENT_ID and CLIENT_SECRET.
84+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
85+
-X POST `
86+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
87+
-H "Content-Type: application/x-www-form-urlencoded" `
88+
-H "Accept: application/json"
89+
90+
# Load document
91+
curl.exe -v "https://api.groupdocs.cloud/v1.0/editor/load" `
92+
-X POST `
93+
-H "Content-Type: application/json" `
94+
-H "Accept: application/json" `
95+
-H "Authorization: Bearer $env:JWT_TOKEN" `
96+
-d "{ 'FileInfo': { 'FilePath': 'Spreadsheet/four-sheets.xlsx' }, 'OutputPath': 'Output', 'WorksheetIndex': 0 }"
97+
```
98+
99+
{{< /tab >}}
100+
101+
{{< tab "Windows CMD" >}}
102+
103+
```cmd
104+
:: First get JSON Web Token
105+
:: Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
106+
:: Place them in the environment variables CLIENT_ID and CLIENT_SECRET.
107+
curl -v "https://api.groupdocs.cloud/connect/token" ^
108+
-X POST ^
109+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
110+
-H "Content-Type: application/x-www-form-urlencoded" ^
111+
-H "Accept: application/json"
112+
113+
:: Load document
114+
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" ^
115+
-X POST ^
116+
-H "Content-Type: application/json" ^
117+
-H "Accept: application/json" ^
118+
-H "Authorization: Bearer %JWT_TOKEN%" ^
119+
-d "{\"FileInfo\":{\"FilePath\":\"Spreadsheet/four-sheets.xlsx\"},\"OutputPath\":\"Output\",\"WorksheetIndex\":0}"
74120
```
75121

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

content/editor/developer-guide/document-edit-operations/working-with-text-documents.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,77 @@ HTTP POST ~/load
4848

4949
## cURL example
5050

51-
{{< tabs "example1">}} {{< tab "Request" >}}
51+
{{< tabs "example1">}} {{< tab "Linux/MacOS/Bash" >}}
5252

5353
```bash
54-
* First get JSON Web Token
55-
* 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.
54+
# First get JSON Web Token
55+
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
56+
# Place Client Id in $CLIENT_ID and Client Secret in $CLIENT_SECRET environment variables.
5657
curl -v "https://api.groupdocs.cloud/connect/token" \
57-
-X POST \
58-
-d "grant_type=client_credentials&client_id=xxxx&client_secret=xxxx" \
59-
-H "Content-Type: application/x-www-form-urlencoded" \
60-
-H "Accept: application/json"
58+
-X POST \
59+
-d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET" \
60+
-H "Content-Type: application/x-www-form-urlencoded" \
61+
-H "Accept: application/json"
6162

62-
* cURL example to load document
63+
# cURL example to load document
6364
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \
64-
-X POST \
65-
-H "Content-Type: application/json" \
66-
-H "Accept: application/json" \
67-
-H "Authorization: Bearer
68-
<jwt token>"
69-
-d "{
65+
-X POST \
66+
-H "Content-Type: application/json" \
67+
-H "Accept: application/json" \
68+
-H "Authorization: Bearer $JWT_TOKEN" \
69+
-d '{
70+
"FileInfo": { "FilePath": "Text/sample.txt" },
71+
"OutputPath": "Output",
72+
"EnablePagination": true
73+
}'
74+
```
75+
76+
{{< /tab >}}
77+
78+
{{< tab "Windows PowerShell" >}}
79+
80+
```powershell
81+
# First get JSON Web Token
82+
# Ensure CLIENT_ID and CLIENT_SECRET are set as environment variables.
83+
curl.exe -v "https://api.groupdocs.cloud/connect/token" `
84+
-X POST `
85+
-d "grant_type=client_credentials&client_id=$env:CLIENT_ID&client_secret=$env:CLIENT_SECRET" `
86+
-H "Content-Type: application/x-www-form-urlencoded" `
87+
-H "Accept: application/json"
88+
89+
# cURL example to load document
90+
curl.exe -v "https://api.groupdocs.cloud/v1.0/editor/load" `
91+
-X POST `
92+
-H "Content-Type: application/json" `
93+
-H "Accept: application/json" `
94+
-H "Authorization: Bearer $env:JWT_TOKEN" `
95+
-d "{
7096
'FileInfo': { 'FilePath': 'Text/sample.txt' },
71-
'OutputPath': 'Output',
72-
'EnablePagination': true
73-
}"
97+
'OutputPath': 'Output',
98+
'EnablePagination': true
99+
}"
100+
```
101+
102+
{{< /tab >}}
103+
104+
{{< tab "Windows CMD" >}}
105+
106+
```cmd
107+
:: First get JSON Web Token
108+
:: Ensure CLIENT_ID and CLIENT_SECRET are set as environment variables.
109+
curl -v "https://api.groupdocs.cloud/connect/token" ^
110+
-X POST ^
111+
-d "grant_type=client_credentials&client_id=%CLIENT_ID%&client_secret=%CLIENT_SECRET%" ^
112+
-H "Content-Type: application/x-www-form-urlencoded" ^
113+
-H "Accept: application/json"
114+
115+
:: cURL example to load document
116+
curl -v "https://api.groupdocs.cloud/v1.0/editor/load" ^
117+
-X POST ^
118+
-H "Content-Type: application/json" ^
119+
-H "Accept: application/json" ^
120+
-H "Authorization: Bearer %JWT_TOKEN%" ^
121+
-d "{\"FileInfo\": {\"FilePath\": \"Text/sample.txt\"}, \"OutputPath\": \"Output\", \"EnablePagination\": true}"
74122
```
75123

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

0 commit comments

Comments
 (0)