Related Documents
Document Properties
Kbid28T432
Last Modified23-Jun-2020
Added to KB23-Aug-2017
Public AccessEveryone
StatusOnline
Doc TypeReferences
Product
  • ICM 7.9
  • ICM 7.10

REST API - Create new order

 

 


Note

Starting with 7.10 our REST API is documented using Redoc accessible at docs.intershop.com.

URI

/orders

Http Method

POST

Short Description

Creates/submits an order

Query Parameters

none

Example Requests

/orders

HTTP Status Codes

201 Created

202 Accepted
400 Bad Request

       Possible values for header value "error-key":

    • basket.not_found.error
    • basket.id_required.error

403 Forbidden
404 Not found
406 Not Acceptable

Description

The request creates / submits a new order based from the basket by the basket ID.

Note that this document only describes requests using the chain based order creation process (see Concept - Order Creation). If handler chains are not active, please refer to this document.

Cartridge

app_sf_rest

Application

B2C Web Shop, SMB Web Shop

Access Restrictions

Requires authentication with user having assigned the following permissions:

  • Purchase (APP_B2B_PURCHASE, only in B2B applications)

Product Version

7.9

Product To Version

 

Status

final

JSON

Request Data Format

application/json

Request related java object

com.intershop.sellside.rest.common.capi.resource.OrderListResource
com.intershop.sellside.rest.common.capi.resourceobject.OrderDescriptionRO

Request Example

{
    "basketID": "mwnAqMgoQWUAAAE8irJXwIE5", 
    "acceptTermsAndConditions": "true"
}

Response Data Format

application/json

Response related java object

com.intershop.sellside.rest.common.capi.resource.OrderListResource
com.intershop.sellside.rest.common.capi.resourceobject.OrderValidationRO
com.intershop.component.rest.capi.resourceobject.LinkRO

Response Example

Successful order creation:

  • Returned status code: 201 Created
{
	"name": "ConfirmedOrder",
	"type": "Link",
	"uri": "inSPIRED-inTRONICS_Business-Site/-/orders/mwnAqMgoQWUAAAE8irJXwIE5"
}

Create order failed due to an non-existing basket:

  • Returned status code: 404 Not Found
  • Example reason: wrong basket ID or order already created for this basket ID
Bad Request (No basket found for the given ID.)

Create order failed due to an existing but invalid basket:

  • Returned status code: 406 Not Acceptable
  • Example: missing cost center
{
	"type": "OrderValidation",
	"errorMessage": "Error(s) occurred during order creation.",
	"basketLink": {
		"type": "Link",
		"uri": "inSPIRED-inTRONICS_Business-Site/-/baskets/qNoKAB2YN1YAAAFb.MpGYEhO",
		"title": "BasketLink"
	},
	"validOrder": false,
	"failures": [
		"CostCenterMissing"
	],
	"warnings": []
}

In general, failures that occur during the order creation will be sent with the "failures" field of the response.

 

Create order failed because another workflow needs to be triggered (e.g., approval) or a redirect needs to happen (e.g., payment) before the order creation can be finished:

  • Returned status code: 202 Accepted
  • Example: order has not been approved yet
{
  "type": "OrderValidation",
  "errorMessage": "Order creation has not yet finished.",
  "validOrder": false,
  "failures": [],
  "warnings": [],
  "stopAction": {
    "type": "StopActionRO",
    "actionType": "WORKFLOW",
    "actionHint": "approval.workflow"
  }
}

The "stopAction" field will display the type and a hint of the action to be performed before the order creation can be continued.

XML

XML Request Data Format

text/xml

XML Request Java Objects

com.intershop.sellside.rest.common.capi.resource.OrderListResource
com.intershop.sellside.rest.common.capi.resourceobject.OrderDescriptionRO

XML Request Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OrderDescription>
	<acceptTermsAndConditions>true</acceptTermsAndConditions>
	<basketID>mwnAqMgoQWUAAAE8irJXwIE5</basketID>
</OrderDescription>

XML Response Data Format

text/xml

XML Response Java Objects

com.intershop.sellside.rest.common.capi.resource.OrderListResource 
com.intershop.sellside.rest.common.capi.resourceobject.OrderValidationRO
com.intershop.component.rest.capi.resourceobject.LinkRO

XML Response Example

Successful order creation:

  • Returned status code: 201 Created
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Link type="Link">
    <title>ConfirmedOrder</title>
    <uri>inSPIRED-inTRONICS-Site/-/orders/7BsKAB2Y0fUAAAFbJQhGYEhm</uri>
</Link>

Create order failed due to an non-existing basket:

  • Returned status code: 404 Not Found
  • Example reason: wrong basket ID or order already created for this basket ID
Bad Request (No basket found for the given ID.)

Create order failed due to an existing but invalid basket:

  • Returned status code: 406 Not Acceptable
  • Example: missing cost center
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OrderValidation type="OrderValidation">
    <basketLink type="Link">
        <title>BasketLink</title>
        <uri>inSPIRED-inTRONICS_Business-Site/-/baskets/YKEKAB2YqesAAAFbrDA4PEh6</uri>
    </basketLink>
    <errorMessage>Error(s) occurred during order creation.</errorMessage>
    <failures>
        <failure>CostCenterMissing</failure>
    </failures>
    <validOrder>false</validOrder>
    <warnings/>
</OrderValidation>

In general, failures that occur during the order creation will be sent with the failures field of the response.

 

Create order failed because another workflow needs to be triggered (e.g., approval) or a redirect needs to happen (e.g., payment) before the order creation can be finished:

  • Returned status code: 202 Accepted
  • Example: order has not been approved yet
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OrderValidation type="OrderValidation">
    <errorMessage>Order creation has not yet finished.</errorMessage>
    <stopAction type="StopActionRO">
        <actionHint>approval.workflow</actionHint>
        <actionType>WORKFLOW</actionType>
    </stopAction>
    <validOrder>false</validOrder>
    <failures/>
    <warnings/>
</OrderValidation>

The "stopAction" field will display the type and a hint of the action to be performed before the order creation can be continued.

Reference - WebShop REST APIs

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets