Add lines to a purchase order. The status of the purchase order must be CONCEPT, REGISTERED or REGISTRATION_REQUESTED.
| Status | Description |
|---|---|
| 200 | Purchase order with lines added. |
| 400 | Invalid request syntax |
curl -X POST 'https://purchase-order.api.myparcel.nl/add-lines' \
-H 'Authorization: bearer <token>' \
-H 'User-Agent: my-integration/1.0' \
-H 'Content-Type: application/json' \
-d '{
"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe",
"lines": [
{
"productId": "a2aacbcc-b6c1-48d5-a9e1-179425737965",
"quantity": 5
}
]
}'<?php
$ch = curl_init("https://purchase-order.api.myparcel.nl/add-lines");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode({"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe", "lines": [{"productId": "a2aacbcc-b6c1-48d5-a9e1-179425737965", "quantity": 5}]}),
CURLOPT_HTTPHEADER => [
'Authorization: bearer <token>',
'User-Agent: my-integration/1.0',
'Content-Type: application/json',
],
]);
$response = json_decode(curl_exec($ch), true);const response = await fetch("https://purchase-order.api.myparcel.nl/add-lines", {
method: 'POST',
headers: {
Authorization: 'bearer <token>',
'User-Agent': 'my-integration/1.0',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe",
"lines": [
{
"productId": "a2aacbcc-b6c1-48d5-a9e1-179425737965",
"quantity": 5
}
]
}),
});
const data = await response.json();import requests
headers = {"Authorization": "bearer <token>", "User-Agent": "my-integration/1.0"}
payload = {
"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe",
"lines": [
{
"productId": "a2aacbcc-b6c1-48d5-a9e1-179425737965",
"quantity": 5
}
]
}
response = requests.post("https://purchase-order.api.myparcel.nl/add-lines", json=payload, headers=headers)
data = response.json()require 'net/http'
require 'json'
require 'uri'
uri = URI('https://purchase-order.api.myparcel.nl/add-lines')
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'bearer <token>'
req['User-Agent'] = 'my-integration/1.0'
req['Content-Type'] = 'application/json'
req.body = "{\"id\": \"93cb8f97-8f08-4f40-960f-98c85c0b7cfe\", \"lines\": [{\"productId\": \"a2aacbcc-b6c1-48d5-a9e1-179425737965\", \"quantity\": 5}]}"
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe", "lines": [{"productId": "a2aacbcc-b6c1-48d5-a9e1-179425737965", "quantity": 5}]}`)
req, _ := http.NewRequest("POST", "https://purchase-order.api.myparcel.nl/add-lines", bytes.NewBuffer(payload))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "bearer <token>")
req.Header.Set("User-Agent", "my-integration/1.0")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://purchase-order.api.myparcel.nl/add-lines"))
.header("Authorization", "bearer <token>")
.header("User-Agent", "my-integration/1.0")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString("{\"id\": \"93cb8f97-8f08-4f40-960f-98c85c0b7cfe\", \"lines\": [{\"productId\": \"a2aacbcc-b6c1-48d5-a9e1-179425737965\", \"quantity\": 5}]}"))
.build();
HttpResponse<String> res = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());
}
}using System.Net.Http;
using System.Text;
var client = new HttpClient();
var req = new HttpRequestMessage(HttpMethod.Post, "https://purchase-order.api.myparcel.nl/add-lines");
req.Headers.Add("Authorization", "bearer <token>");
req.Headers.Add("User-Agent", "my-integration/1.0");
req.Content = new StringContent(@"{""id"": ""93cb8f97-8f08-4f40-960f-98c85c0b7cfe"", ""lines"": [{""productId"": ""a2aacbcc-b6c1-48d5-a9e1-179425737965"", ""quantity"": 5}]}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(req);
var data = await response.Content.ReadAsStringAsync();{
"id": "93cb8f97-8f08-4f40-960f-98c85c0b7cfe",
"createdAt": "2024-02-04T00:00:00.123000+00:00",
"fulfilmentPlatform": "VASCO",
"lines": [
{
"product": {
"id": "a2aacbcc-b6c1-48d5-a9e1-179425737965",
"name": "Product 1",
"ean": "1234567890123",
"sku": "SKU123"
},
"quantity": 5
}
]
}