Create an Order
POST/orders/
v2
POST
order-create-order
Request
Responses
Usage examples
- cURL
- JavaScript SDK
- PHP SDK
$ curl \
--fail \
--location \
-X POST \
-d '{"orderData":{"customerId":"0f5ec9cd-1b1b-4850-9061-fcebe765c62d","description":"My first project","diskspaceInGiB":20,"promotionCode":"123456","recommendationCode":"mp-123456","spec":{"machineType":"prospace.2cpu.4gb"},"useFreeTrial":true},"orderType":"projectHosting"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/orders
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";
const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.contract.orderCreateOrder({
"data": {
"orderData": {
"customerId": "0f5ec9cd-1b1b-4850-9061-fcebe765c62d",
"description": "My first project",
"diskspaceInGiB": 20,
"promotionCode": "123456",
"recommendationCode": "mp-123456",
"spec": {
"machineType": "prospace.2cpu.4gb"
},
"useFreeTrial": true
},
"orderType": "projectHosting"
}
});
assertStatus(response, 201);
use \Mittwald\ApiClient\Generated\V2\Clients\Contract\OrderCreateOrder\OrderCreateOrderRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Contract\OrderCreateOrder\OrderCreateOrderRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// OrderCreateOrderRequestBody to learn how to construct a valid instance
$body = new OrderCreateOrderRequestBody(/* TODO: ... */);
$request = (new OrderCreateOrderRequest(
body: $body
));
$response = $client->contract()->orderCreateOrder($request);
var_dump($response->getBody();