„POST /order“ ändern

master
Thomas Brinkmann 3 years ago
parent d19c3c3b7d
commit 90a24fd787
  1. 98
      POST-%2Forder.md

@ -0,0 +1,98 @@
## **POST /order**
## **Inhalt**
---
- Parameter
- Optionale Parameter
- Beispiel Anfrage
- Beispiel Antwort
- Mögliche Fehlermeldungen
---
### Parameter
|URL Parameter | Typ | Beschreibung|
|----------|-----|-------------|
| paymentmethod | string | Die Zahlungsmethode für diese Bestellung (Kann in der Rechnung trotzdem frei verändert werden!)
| pid | array | Ein integer array mit den Produkt IDs die man bestellen möchte
| billingcycle | array | Ein string array mit den Billing Cycles der Produkte (monthly, quarterly, semiannually, annually)
| hostname | array | Ein string array mit den Hostnamen der Produkte
| rootpw | array | Ein string array mit den Passwörtern für die Produkte
|Body Parameter | Typ | Beschreibung|
|----------|-----|-------------|
| - | - | - |
---
### Optionale Parameter
|Query-String Parameter | Typ | Beschreibung|
|----------|-----|-------------|
|- | - | -
---
### Beispiel Anfrage
##### PHP
```php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'control.local/api/v2/order',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS =>'{
"paymentmethod": "paypal",
"pid": [1,2],
"billingcycle": ["monthly", "monthly"],
"hostname": ["a.server.de", "b.server.de"],
"rootpw": ["passwort-server-a", "password-server-b"]
}'
CURLOPT_HTTPHEADER => array(
'X-TOKEN: test-token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
##### cURL
```bash
curl --location --request GET 'control.local/api/v2/order' \
--header 'X-TOKEN: test-token' \
--header 'Content-Type: application/json' \
--data-raw '{
"paymentmethod": "paypal",
"pid": [1,2],
"billingcycle": ["monthly", "monthly"],
"hostname": ["a.server.de", "b.server.de"],
"rootpw": ["passwort-server-a", "password-server-b"]
}'
```
---
### Beispiel Antwort
```json
{
"status": "OK",
"orderid": "12345678910",
"serviceids": "1,2"
```
### Mögliche Fehlermeldungen
> :warning: Status Code **403** - Permission denied
> :warning: Status Code **500** - Order could not be placed
Loading…
Cancel
Save