Copy a request as code
Take a request out of TotalAPI, to run it in a terminal, to send it to someone or to use it in your program.
On this page
Copy it
Right-click the request in the list and choose:
| Choice | What you get |
|---|---|
| Copy as curl | A curl command for a terminal with bash or zsh |
| Copy as fetch | JavaScript that sends it with fetch and reads the answer as JSON |
| Copy as TAPI (jComponent) | The call of a Total.js action for the interface of the app, only in those requests |
Copy as curl is also among the commands, for the request that you have open.
What the code has
The curl command and the fetch code are the request as it would go now: with the values of the environment written in, the headers, the body and the auth. The cookies that TotalAPI keeps are not there.
The values of secret variables are written in too. Look at the command before you send it to someone.
The TAPI call has the values of the form as you wrote them, with the variables as {{name}}. A parameter without a value stays as {name}, for you to write yours:
TAPI('users_remove/{id} ERROR', function(response) {
});To bring a command in, see Import requests.