Skip to content

Latest commit

 

History

History
103 lines (99 loc) · 3.11 KB

gs-curl.md

File metadata and controls

103 lines (99 loc) · 3.11 KB
group subgroup title menu_title menu_order functional_areas
web-api
20_REST
Use cURL to run the request
Use cURL to run the request
2
Integration

cURL is a command-line tool that lets you transmit and receive HTTP requests and responses from the command line or a shell script. It is available for Linux distributions, Mac OS X, and Windows.

To use cURL to run your REST web {% glossarytooltip 786086f2-622b-4007-97fe-2c19e5283035 %}API{% endglossarytooltip %} call, use the cURL command syntax to construct the cURL command.

To create the endpoint in the call, append the REST URI that you constructed in Step 3. Construct a request to this URL:

https://<MAGENTO_HOST_OR_IP>/<MAGENTO_BASE_INSTALL_DIR>/rest/

To pass the customer data object in the POST call payload, specify a JSON or {% glossarytooltip 8c0645c5-aa6b-4a52-8266-5659a8b9d079 %}XML{% endglossarytooltip %} request body on the call.

For a complete list of cURL command options, see curl.1 the man page.

The cURL examples in this guide use the following command-line options:

Option Description

-d

Sends the specified data in a POST request to the HTTP server. Use this option to send a JSON or XML request body to the server.

-H

Specifies an extra HTTP header in the request. Precede each header with the -Hoption. You can specify any number of extra headers.

For a list of common headers used in Magento web API requests, see HTTP headers.

-i

Includes the HTTP header in the output.

-s

Specifies silent or quiet mode, which makes cURL mute. Progress and error messages are suppressed.

-T

Transfers the specified local file to the remote URL.

-X

Specifies the request method to use when communicating with the HTTP server. The specified request method is used instead of the default GET method.

Next step