You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: challenger/src/main/resources/content/apichallenges/solutions/miscellaneous/delete-all-todos.md
+107Lines changed: 107 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,3 +44,110 @@ Some tools have the ability to issue Data Driven requests, so if you can parse t
44
44
45
45
Most of the API client tools also have the ability to create scripts to achieve this.
46
46
47
+
## Deleting All `todo`s using Command Line Tools
48
+
49
+
I'm going use standard Linux/Unix/Bash commands here.
50
+
51
+
I can use a combination of `curl`, `jq`, and `xargs` to achieve what I want.
52
+
53
+
-[cUrl](https://curl.se/) command line HTTP client
54
+
-[jq](https://jqlang.github.io/jq/) a command line JSON processor
55
+
-[xargs](https://pubs.opengroup.org/onlinepubs/9799919799/utilities/xargs.html) piping parameters into commands [examples](https://en.wikipedia.org/wiki/Xargs)
56
+
57
+
I can use all these linux commands on Windows using a WSL ((Windows Subsystem for Linux)[https://learn.microsoft.com/en-us/windows/wsl/about]) which means I can use the same commands as a mac and make this solution portable.
58
+
59
+
I'm running Ubuntu in my WSL
60
+
61
+
First issue a curl request to get the todos in API challenges.
62
+
63
+
If I don't know how to create the `culr` command I can generate the `curl` command easily by using Bruno to generate the code (most REST Clients also have this feature).
64
+
65
+
- create request in Bruno with the X-CHALLENGER header
66
+
- try it out
67
+
- right click on the item in the left side bar and `Generate Code` and then choose `Shell-Curl`
0 commit comments