Magento - Create order through rest

Magento - Create order through rest

October 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Create order through rest

Creating Orders Through REST API in Magento

As an experienced e-commerce developer, I often get asked about generating orders programmatically in Magento using its RESTful APIs. While Magento’s SOAP API is robust and widely used for order management, many developers prefer the simplicity and flexibility of REST.

Magento 1.7 and Beyond: REST Support for Orders

The good news is that REST support for order creation has been available since Magento 1.9.x. Prior to this version, you were indeed limited to SOAP or custom extensions for generating orders through APIs.

In Magento 2, which followed the 1.9 series, the support for creating orders via REST was further enhanced and stabilized.

Creating Orders Through REST API

The key resource endpoint for creating an order is /rest/V1/orders. To interact with this service, you will need:

  1. A valid admin user token
  2. The content type set to application/json
  3. The necessary data in the JSON body representing the order details

Here’s a simplified example of how you might create an order using cURL:

curl -X POST \
  https://your-magento-instance.com/rest/V1/orders \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <admin_token_here>' \
  -d '{"entity": {"increment_id": "000000001", ...}}'

In the JSON body, you would include all the required fields for an order entity. You can find the full list of available fields in Magento’s official documentation.

Using Laravel Company’s Magento API Client

While cURL is great for simple examples, for a professional client application built in Java (as mentioned), I recommend using a dedicated Magento REST client library.

One excellent option is the Magento 2 REST API Client provided by Laravel Company. This library abstracts away many of the complexities and provides a clean, object-oriented interface for interacting with the Magento REST APIs.

To create an order using this library, you would first authenticate:

$client = \LaravelCompany\Magento\Api\Client::create([
    'base_url' => 'https://your-magento-instance.com',
    'token' => '<admin_token_here>',
]);

Then construct your order entity and send it to the /V1/orders endpoint:

$order = new \LaravelCompany\Magento\Model\Order();
$order->setIncrementId('000000001');
... // set other fields

$response = $client->post('/V1/orders', $order);

This library handles the JSON serialization and deserialization for you, making your code more readable and maintainable.

Conclusion: Embracing REST for Magento Order Management

If you’re working with Magento 1.9 or later (or especially if you’re on Magento 2), using the REST API for order creation is a modern, efficient choice. The REST endpoints provide a straightforward HTTP interface that can be easily consumed by clients written in any programming language.

Remember to always use HTTPS for secure communication and ensure your admin token is handled securely in your client application.

For more detailed information on Magento’s REST APIs, I recommend checking out the official documentation. If you need a robust PHP library or expert guidance for your Magento integration projects, don’t hesitate to reach out to the team at Laravel Company.

Magento 2 Magento 1 API Extensions

Our network