deliveryOrderOpen
Required scope: edit_delivery_orders
Transitions a delivery order from DRAFT to PENDING, marking it as ready for processing. Once opened, the delivery order can be sent to the warehouse for fulfillment via deliveryOrderRequestFulfillment.
Mutation
graphql
mutation DeliveryOrderOpen($id: String!) {
deliveryOrderOpen(id: $id) {
id
type
state
message
}
}Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
id | String! | Yes | UUID of the delivery order to open |
Return Type
The mutation returns a MutationResult object:
| Field | Type | Description |
|---|---|---|
id | ID! | UUID of the affected delivery order |
type | String! | Always "delivery_order" |
state | String! | Result state: "success" or "error" |
message | String | Human-readable message describing the outcome |
Example
Variables
json
{
"id": "do_abc123"
}Response
json
{
"data": {
"deliveryOrderOpen": {
"id": "do_abc123",
"type": "delivery_order",
"state": "success",
"message": "Delivery order opened successfully."
}
}
}Code Examples
bash
curl -X POST https://api-v3.happycolis.com/graphql \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "mutation DeliveryOrderOpen($id: String!) { deliveryOrderOpen(id: $id) { id type state message } }",
"variables": {
"id": "do_abc123"
}
}'js
async function deliveryOrderOpen(accessToken, id) {
const response = await fetch('https://api-v3.happycolis.com/graphql', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: `
mutation DeliveryOrderOpen($id: String!) {
deliveryOrderOpen(id: $id) {
id
type
state
message
}
}
`,
variables: { id },
}),
});
const { data, errors } = await response.json();
if (errors) throw new Error(errors[0].message);
return data.deliveryOrderOpen;
}
// Usage
const result = await deliveryOrderOpen(accessToken, 'do_abc123');python
import requests
def delivery_order_open(access_token, delivery_order_id):
response = requests.post(
'https://api-v3.happycolis.com/graphql',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json',
},
json={
'query': '''
mutation DeliveryOrderOpen($id: String!) {
deliveryOrderOpen(id: $id) {
id
type
state
message
}
}
''',
'variables': {'id': delivery_order_id},
},
)
result = response.json()
if 'errors' in result:
raise Exception(result['errors'][0]['message'])
return result['data']['deliveryOrderOpen']
# Usage
result = delivery_order_open(access_token, 'do_abc123')php
function deliveryOrderOpen(string $accessToken, string $id): array
{
$client = new \GuzzleHttp\Client();
$response = $client->post('https://api-v3.happycolis.com/graphql', [
'headers' => [
'Authorization' => 'Bearer ' . $accessToken,
'Content-Type' => 'application/json',
],
'json' => [
'query' => '
mutation DeliveryOrderOpen($id: String!) {
deliveryOrderOpen(id: $id) {
id
type
state
message
}
}
',
'variables' => ['id' => $id],
],
]);
$result = json_decode($response->getBody()->getContents(), true);
if (isset($result['errors'])) {
throw new \Exception($result['errors'][0]['message']);
}
return $result['data']['deliveryOrderOpen'];
}
// Usage
$result = deliveryOrderOpen($accessToken, 'do_abc123');go
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func deliveryOrderOpen(accessToken string, id string) (map[string]interface{}, error) {
query := `
mutation DeliveryOrderOpen($id: String!) {
deliveryOrderOpen(id: $id) {
id
type
state
message
}
}
`
body, _ := json.Marshal(map[string]interface{}{
"query": query,
"variables": map[string]interface{}{"id": id},
})
req, _ := http.NewRequest("POST", "https://api-v3.happycolis.com/graphql", bytes.NewBuffer(body))
req.Header.Set("Authorization", "Bearer "+accessToken)
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
if errs, ok := result["errors"]; ok {
return nil, fmt.Errorf("graphql error: %v", errs)
}
data := result["data"].(map[string]interface{})
return data["deliveryOrderOpen"].(map[string]interface{}), nil
}