Migration guide from v1.3.0 to v2.0.0
Overview
This guide provides a comprehensive overview of migrating from our existing v1.3.0 API to the new v2.0.0. It provides examples of how to perform queries before and after the migration, allowing users to understand the differences between versions.
Please note that these examples represent only a subset of the changes in the API. However, the new API is powerful and provides more detailed information than the previous version. Therefore, we highly recommend reviewing the entirety of the API documentation for a thorough overview of all available queries and mutations.
Authentication
v1.3.0
To retrieve an authentication token in the previous version, you would perform the following mutation:
Example request:
mutation ($input: getApplicationTokenInput) {
getApplicationToken(input: $input) {
access_token
expires_in
}
}
Variables:
{
"input":{
"username":"my-apotheke@mycompany.com",
"password":"my-password",
"client":"web-client",
"businessUnit":"docmorris"
}
}
Example response:
{
"data":{
"getApplicationToken":{
"access_token":"eyJhbGciOiJSUz...",
"expires_in":"2023-03-22 10:00:00"
}
}
}
v2.0.0
In the current version, the mutation structure has been modified:
Example request:
mutation GetApplicationToken($username: String!, $password: String!) {
getApplicationToken(username: $username, password: $password) {
tokens {
accessToken {
value
expiresIn
}
refreshToken {
value
expiresIn
}
}
errors {
code
message
}
}
}
Example response:
{
"data": {
"getApplicationToken": {
"tokens": {
"accessToken": {
"value": "eyJhbGciOiJSUz...",
"expiresIn": 1800
},
"refreshToken": {
"value": "eyJhbGciOiJSUz...",
"expiresIn": 1800
}
}
},
"errors": null
}
}
Summary of Changes
- Expires value in seconds
Search Orders
v1.3.0
To retrieve the orders in the previous version, you would perform the following query:
Example request:
query SearchOrders($input: Orders_Order_SearchOrdersInput) {
response: Orders_Order_SearchOrders(input: $input) {
data {
id
externalOrderId
customerOrderCode
approvedAt
updatedAt
user {
externalUserId
email
birthDate
gender
}
shippingAddress {
name
surname
postalAddressLineOne
postalAddressLineTwo
houseNumber
city
postalCode
phoneNumberOne
}
subOrders {
subOrderId
sellerId
shipping {
deliveryCommitment
shippingCosts
timeSlot {
from
to
}
}
orderItems {
orderItemId
externalProductId
productId
imageUri
name
productType
customerPriceWithDiscount {
amount
currency
}
customerPriceWithDiscountPerUnitsToSend {
amount
currency
}
sellerPrice {
amount
currency
}
unitsToSend
}
totalSellerPrice {
amount
currency
}
}
}
metadata {
itemsPerPage
currentPage
totalItems
totalPages
}
}
}
Variables:
{
"input": {
"hasShipment": false,
"includes": ["orderItems"],
"pagination": {
"page": 1,
"size": 20
},
"updatedAt":{
"from": "2022-05-01T11:12:27+0000",
"to": "2023-05-30T11:12:27+0000"
}
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
"locale": "de_DE"
}
Example response:
{
"data": {
"response": {
"data": [
{
"id": "e0bc5aa4-51e8-420b-96a9-05a80a1e2328",
"externalOrderId": "118519",
"customerOrderCode": "2JG7",
"approvedAt": "2023-05-29T08:30:47+0000",
"updatedAt": "2023-05-29T08:31:10+0000",
"user": {
"externalUserId": "5ba30d0a-2224-430e-bb9b-a48108cb7fae",
"email": "android+orders.admin@promofarma.com",
"birthDate": "1990-01-01T00:00:00+0000",
"gender": ""
},
"shippingAddress": {
"name": "Test address",
"surname": "",
"postalAddressLineOne": "Strasse TestQa",
"postalAddressLineTwo": "",
"houseNumber": "",
"city": "Rosenheim",
"postalCode": "83024",
"phoneNumberOne": "611111111"
},
"subOrders": [
{
"subOrderId": "68ca20d6-67c9-4458-8043-4d13d850bb47",
"sellerId": "aebcb391-c7ab-49d1-9412-889ca9d0eae7",
"shipping": {
"deliveryCommitment": "standard",
"shippingCosts": "3.5000",
"timeSlot": {
"from": null,
"to": null
}
},
"orderItems": [
{
"orderItemId": "46ad3e40-f490-4fc3-96a9-4c80b2dcac4e",
"externalProductId": "20006014",
"productId": "27db58b3-9852-46b4-86ce-c4b25e8b5847",
"imageUri": "/docmorris/stg/product_images/e1bc66a3-4917-407b-96e5-b2f7479f6584_2.jpg",
"name": "32645.1 OTC",
"productType": "otc",
"customerPriceWithDiscount": {
"amount": "9.4500",
"currency": "EUR"
},
"customerPriceWithDiscountPerUnitsToSend": {
"amount": "18.9000",
"currency": "EUR"
},
"sellerPrice": {
"amount": "9.4500",
"currency": "EUR"
},
"unitsToSend": 2
}
],
"totalSellerPrice": {
"amount": "18.9000",
"currency": "EUR"
}
}
]
}
],
"metadata": {
"itemsPerPage": 20,
"currentPage": 1,
"totalItems": 1,
"totalPages": 1
}
}
}
}
v2.0.0
In the current version, the query structure has been modified:
Example request:
query Orders($pagination: PaginationArgs, $filters: OrdersFilter) {
orders(pagination: $pagination, filters: $filters) {
collection {
id
code
approvedAt
updatedAt
user {
id
profile {
birthday
gender
email
}
}
shippingAddress {
name
lastName
street
streetNumber
city
administrativeArea
postalCode
country
phone
}
billingAddress {
name
lastName
street
streetNumber
city
administrativeArea
postalCode
country
phone
}
subOrders {
id
seller {
externalId
}
items {
id
unitsToSend
product {
id
name
nationalCodes {
code
acronym
country
}
eans {
code
}
}
unitPrice {
amount
currency
}
}
totalPricePerUnitsToSend {
amount
currency
}
totalPriceWithDiscountPerUnitsToSendWithShippingCosts {
amount
currency
}
shipments {
delivery {
commitment
type
}
costs {
amount
currency
}
timeSlot {
from
to
}
courier {
id
name
}
trackingNumber
}
}
}
metadata {
totalItems
totalPages
currentPage
}
}
}
Variables:
{
"pagination": {
"page": 1,
"size": 2
},
"filters": {
"code": {
"eq": null
},
"hasShipment": {
"eq": null
},
"id": {
"eq": null
},
"itemStatus": null,
"updatedAt": {
"from": null,
"to": null
},
"sort": {
"criteria": [
{
"field": "created_at",
"type": "DESC"
}
]
}
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
"locale": "de_DE"
}
Example response:
{
"data": {
"orders": {
"collection": [
{
"id": "e8138eb0-823f-4141-aa06-7768f29c2e27",
"code": "6",
"approvedAt": "2023-07-23T19:40:42+0000",
"updatedAt": "2023-07-23T19:40:42+0000",
"user": {
"id": "b1048b4d-1ffb-43dd-ae7f-49d458d525ac",
"profile": {
"birthday": null,
"gender": null,
"email": ""
}
},
"shippingAddress": {
"name": "Albert",
"lastName": "Einstein",
"street": "Preysingstr. Preysingstr.",
"streetNumber": "1234",
"city": "München",
"administrativeArea": null,
"postalCode": "81667",
"country": "DE",
"phone": "611111111"
},
"billingAddress": {
"name": "Albert",
"lastName": "Einstein",
"street": "Preysingstr. Preysingstr.",
"streetNumber": "1234",
"city": "München",
"administrativeArea": null,
"postalCode": "81667",
"country": "DE",
"phone": "611111111"
},
"subOrders": [
{
"id": "64aa9541-5b00-41b3-94b8-27f670251352",
"seller": {
"externalId": "8384d54d-ed52-440a-88a7-c1bb0e4ce4ce"
},
"items": [
{
"id": "88361e88-2d71-4ec0-ae73-1e5fb431266b",
"unitsToSend": 1,
"product": {
"id": "d1f43aaa-4ca9-4038-a6d5-f26724097f36",
"name": "Hyabak Augentropfen BPC",
"nationalCodes": [
{
"code": "20006033",
"acronym": "pzn",
"country": "DE"
}
],
"eans": [
{
"code": "2000600000033"
}
]
},
"unitPrice": {
"amount": 5.5,
"currency": "EUR"
}
}
],
"totalPricePerUnitsToSend": {
"amount": 5.5,
"currency": "EUR"
},
"totalPriceWithDiscountPerUnitsToSendWithShippingCosts": {
"amount": 11.45,
"currency": "EUR"
},
"shipments": []
}
]
},
{
"id": "f0f4f1e0-6f1d-4a40-aa90-2db819ba7b9a",
"code": "7",
"approvedAt": "2023-07-23T19:37:42+0000",
"updatedAt": "2023-07-23T19:37:42+0000",
"user": {
"id": "b1048b4d-1ffb-43dd-ae7f-49d458d525ac",
"profile": {
"birthday": null,
"gender": null,
"email": ""
}
},
"shippingAddress": {
"name": "Boris",
"lastName": "Becker",
"street": "Bundesstraße Bundesstraße",
"streetNumber": "321",
"city": "Berlin",
"administrativeArea": null,
"postalCode": "10115",
"country": "DE",
"phone": "633333333"
},
"billingAddress": {
"name": "Boris",
"lastName": "Becker",
"street": "Bundesstraße Bundesstraße",
"streetNumber": "321",
"city": "Berlin",
"administrativeArea": null,
"postalCode": "10115",
"country": "DE",
"phone": "633333333"
},
"subOrders": [
{
"id": "df07dac6-620d-4910-9286-e01527e266a4",
"seller": {
"externalId": "8384d54d-ed52-440a-88a7-c1bb0e4ce4ce"
},
"items": [
{
"id": "c2cc9a39-e6af-485c-b616-e537429fb678",
"unitsToSend": 2,
"product": {
"id": "d1f43aaa-4ca9-4038-a6d5-f26724097f36",
"name": "Hyabak Augentropfen BPC",
"nationalCodes": [
{
"code": "20006033",
"acronym": "pzn",
"country": "DE"
}
],
"eans": [
{
"code": "2000600000033"
}
]
},
"unitPrice": {
"amount": 5.5,
"currency": "EUR"
}
}
],
"totalPricePerUnitsToSend": {
"amount": 11,
"currency": "EUR"
},
"totalPriceWithDiscountPerUnitsToSendWithShippingCosts": {
"amount": 16.95,
"currency": "EUR"
},
"shipments": []
}
]
}
],
"metadata": {
"totalItems": 9,
"totalPages": 5,
"currentPage": 1
}
}
}
}
Summary of Changes
- Locale header must be sent. Format: "de_DE"
Get Order Detail
v1.3.0
To get an order detail in the previous version, you would perform the following query:
Example request:
query Order($orderId: ID!) {
order(id: $orderId) {
id
code
approvedAt
updatedAt
user {
id
profile {
birthday
gender
email
}
}
shippingAddress {
name
lastName
street
streetNumber
city
administrativeArea
postalCode
country
phone
}
billingAddress {
name
lastName
street
streetNumber
city
administrativeArea
postalCode
country
phone
}
subOrders {
id
seller {
externalId
}
items {
id
unitsToSend
product {
id
name
nationalCodes {
code
acronym
country
}
eans {
code
}
}
unitPrice {
amount
currency
}
}
totalPricePerUnitsToSend {
amount
currency
}
totalPriceWithDiscountPerUnitsToSendWithShippingCosts {
amount
currency
}
shipments {
delivery {
commitment
type
}
costs {
amount
currency
}
timeSlot {
from
to
}
courier {
id
name
}
trackingNumber
}
}
}
}
Variables:
{
"id": "84d7862e-4116-48e0-8902-57dc7ab64ad6"
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
"locale": "de_DE"
}
Example response:
{
"data": {
"order": {
"id": "84d7862e-4116-48e0-8902-57dc7ab64ad6",
"code": "2wcy",
"approvedAt": "2023-07-24T10:59:49+0000",
"updatedAt": "",
"user": {
"id": "8aa62303-6da7-4d48-8872-667dfd4f9fb3",
"profile": {
"birthday": "1990-01-01",
"gender": null,
"email": ""
}
},
"shippingAddress": {
"name": "Test address",
"lastName": "",
"street": "Strasse TestQa ",
"streetNumber": "",
"city": "Rosenheim",
"administrativeArea": "Bayern",
"postalCode": "83024",
"country": "DE",
"phone": "611111111"
},
"billingAddress": {
"name": "Test address",
"lastName": "",
"street": "Strasse TestQa ",
"streetNumber": "",
"city": "Rosenheim",
"administrativeArea": "Bayern",
"postalCode": "83024",
"country": "DE",
"phone": "611111111"
},
"subOrders": [
{
"id": "f8c9e86b-5331-4004-bfa2-d0a1bc8e7237",
"seller": {
"externalId": "aebcb391-c7ab-49d1-9412-889ca9d0eae7"
},
"items": [
{
"id": "958fe9c6-03e0-4d0e-a92f-40919dbbd407",
"unitsToSend": 2,
"product": {
"id": "27db58b3-9852-46b4-86ce-c4b25e8b5847",
"name": "32645.1 OTC",
"nationalCodes": [
{
"code": "20006014",
"acronym": "pzn",
"country": "DE"
}
],
"eans": [
{
"code": "2000600000014"
}
]
},
"unitPrice": {
"amount": 9.45,
"currency": "EUR"
}
}
],
"totalPricePerUnitsToSend": {
"amount": 18.9,
"currency": "EUR"
},
"totalPriceWithDiscountPerUnitsToSendWithShippingCosts": {
"amount": 22.4,
"currency": "EUR"
},
"shipments": [
{
"delivery": {
"commitment": "standard",
"type": "address_delivery"
},
"costs": {
"amount": 3.5,
"currency": "EUR"
},
"timeSlot": {
"from": null,
"to": null
},
"courier": {
"id": "a9a27976-ada3-4ac6-b242-661220f4fa07",
"name": "DPD"
},
"trackingNumber": "8751793088"
}
]
}
]
}
}
}
v2.0.0
In the current version, the query structure has been modified:
Example request:
query Query($orderId: ID!) {
order(id: $orderId) {
id
code
approvedAt
user {
profile {
email
birthday
}
}
subOrders {
id
seller {
externalId
}
shipments {
delivery {
commitment
type
}
costs {
amount
currency
}
timeSlot {
from
to
}
}
unitsToSend
totalPricePerUnitsToSend {
amount
currency
}
totalPriceWithDiscountPerUnitsToSendWithShippingCosts {
amount
currency
}
items {
id
product {
id
name
nationalCodes {
acronym
code
country
}
}
unitPrice {
amount
currency
}
unitsToSend
}
}
}
}
Variables:
{
"orderId": "7f718a2e-6396-4735-a111-173a874a68fb"
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
"locale": "de_DE"
}
Example response:
{
"data": {
"order": {
"id": "7f718a2e-6396-4735-a111-173a874a68fb",
"code": "2ju5",
"approvedAt": "2023-05-30T11:11:48+0000",
"seller": {
"externalId": "6edd791d-3c2b-49f1-af54-5ff72da7d012"
},
"user": {
"profile": {
"email": "mail@domain.com",
"birthday": "1995-05-30"
},
},
"subOrders": [
{
"id": "f1ed80b7-2512-409d-b181-4c3d75a6f821",
"shipments": [
{
"delivery": {
"commitment": "standard",
"type": "address_delivery"
},
"costs": {
"amount": 3.5,
"currency": "EUR"
},
"timeSlot": {
"from": null,
"to": null
}
}
],
"unitsToSend": 2,
"totalPricePerUnitsToSend": {
"amount": 18.9,
"currency": "EUR"
},
"totalPriceWithDiscountPerUnitsToSendWithShippingCosts": {
"amount": 22.4,
"currency": "EUR"
},
"items": [
{
"id": "f3eab1c0-c659-4af0-84ef-4562f671081b",
"product": {
"id": "27db58b3-9852-46b4-86ce-c4b25e8b5847",
"name": "32645.1 OTC",
"nationalCodes": [
{
"acronym": "pzn",
"code": "20006014",
"country": "DE"
}
]
},
"unitPrice": {
"amount": 9.45,
"currency": "EUR"
},
"unitsToSend": 2
}
]
}
]
}
}
}
Summary of Changes
- customerPriceWithDiscount field on the new query is renamed to unitPrice
- A suborder can have more than one shipment, so now instead of shipment it is an array of shipments
Get Couriers By Country
v1.3.0
To retrieve the courier list by it's country in the previous version, you would perform the following query:
Example request:
query getCouriersByCountry ($country_code: String!) {
getCouriersByCountry (country_code: $country_code) {
country
couriers {
courierId
courierName
}
}
}
Variables:
{
"country_code": "de"
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data":{
"getCouriersByCountry":{
"country":"DE",
"couriers":[
{
"courierId":"33447290-b7a8-4c5f-8108-961fe7026b8e",
"courierName":"DHL PARCEL"
},
{
"courierId":"3d9b2780-8f57-406c-a68d-e734119319d5",
"courierName":"WARENPOST"
}
]
}
}
}
v2.0.0
In the current version, the query structure has been modified:
Example request:
query Couriers($countryCode: String!) {
couriers(countryCode: $countryCode) {
id
name
}
}
Variables:
{
"countryCode": "DE"
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data": {
"couriers": [
{
"id": "33447290-b7a8-4c5f-8108-961fe7026b8e",
"name": "DHL PARCEL"
},
{
"id": "3d9b2780-8f57-406c-a68d-e734119319d5",
"name": "WARENPOST"
}
]
}
}
Summary of Changes
- Country is no longer returned as in the previous version.
Notify Shipment Pickup
v1.3.0
To notify shipment pickup in the previous version, you would perform the following mutation:
Example request:
mutation SHP_notifyShipmentPickup($input: SHP_notifyShipmentPickupRequest) {
SHP_notifyShipmentPickup(input: $input) {
code
message
}
}
Variables:
{
"input":{
"courier_id":null,
"order_id":"cd5d2fcf-0e5c-484c-81fb-767e0cce8c0c",
"sub_order_id":"db4ff845-c94a-4599-afbd-5303811ad16f",
"seller_id":"4625a862-794f-42c2-9979-6a1e30259f6b",
"products":[
{
"product_id":"8cb13580-0e62-426f-91fa-7b9bf04edffe",
"quantity":1
},
{
"product_id":"78bd178d-f14a-4acd-aa99-ad74949719bc",
"quantity":2
}
],
"tracking_number":null
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data":{
"getCouriersByCountry":{
"country":"DE",
"couriers":[
{
"courierId":"33447290-b7a8-4c5f-8108-961fe7026b8e",
"courierName":"DHL PARCEL"
},
{
"courierId":"3d9b2780-8f57-406c-a68d-e734119319d5",
"courierName":"WARENPOST"
}
]
}
}
}
v2.0.0
In the current version, the mutation structure has been modified:
Example request:
mutation NotifyShipmentPickup(
$orderId: ID!,
$subOrderId: ID!,
$sellerId: ID!,
$products: [NotifyShipmentPickupProductsInput!]!,
$courierId: ID,
$trackingNumber: String
) {
notifyShipmentPickup(
orderId: $orderId,
subOrderId: $subOrderId,
sellerId: $sellerId,
products: $products,
courierId: $courierId,
trackingNumber: $trackingNumber
) {
message
errors {
message
code
}
}
}
Variables:
{
"orderId": "0edd74ac-7f9d-4f39-9ba4-f382544f9b0e",
"subOrderId": "9053ec00-a2f6-4132-ab21-172a2b9c6f07",
"sellerId": "50dc2608-401a-4d8e-a885-63cbb2f974b7",
"products": [
{
"productId": "d4488544-fb10-4be9-8cec-a349662b2c47",
"quantity": 1
}
],
"courierId": "5d6b9ec5-8c31-4e2d-add4-5cdc1826eb5e",
"trackingNumber": "DE546323125646"
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data": {
"notifyShipmentPickup": {
"errors": [],
"message": "SUCCESS"
}
}
}
Cancel Order
v1.3.0
To cancel an order in the previous version, you would perform the following mutation:
Example request:
mutation Orders_Order_cancelOrder($input: Orders_Order_CancelOrderInput) {
Orders_Order_cancelOrder(input: $input) {
code
data
message
}
}
Variables:
{
"input": {
"orderId": "7f718a2e-6396-4735-a111-173a874a68fb",
"items": {
"orderItemId": "f3eab1c0-c659-4af0-84ef-4562f671081b",
"type": "cancellation",
"cancellationReason": "wrong_product",
"units": 1
}
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
Cancel Order
v2.0.0
In the current version, the mutation structure has been modified:
Example request:
mutation OrderCancel(
$orderId: ID!,
$cancellationType: CancellationType!,
$items: [CancellationItemInput!]!
) {
orderCancel(id: $orderId, cancellationType: $cancellationType, items: $items) {
errors {
code
message
}
message
}
}
Variables:
{
"orderId": "7f718a2e-6396-4735-a111-173a874a68fb",
"cancellationType": "cancellation",
"items": [
{
"orderItemId": "f3eab1c0-c659-4af0-84ef-4562f671081b",
"cancellationReason": "wrong_product",
"units": 1
}
]
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data": {
"orderCancel": {
"errors": [],
"message": "SUCCESS"
}
}
}
Get Cancellation Reasons
v1.3.0
To get cancellation in the previous version, you would perform the following query:
Example request:
query {
getOrderReasons(
input: {
filters: {
type: [cancellation]
}
}
) {
type
reasons {
value
}
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data":{
"getOrderReasons":[
{
"type":"cancellation",
"reasons":[
{
"value":"wrong_product"
},
{
"value":"defective_product"
}
]
}
]
}
}
v2.0.0
In the current version, the query structure has been modified:
Example request:
query OrderReasons($filters: OrderReasonsTypesFilters) {
orderReasons(filters: $filters) {
type
reasons {
value
}
}
}
Headers:
{
"Authorization": "Bearer eyJhbGciO...",
}
Example response:
{
"data": {
"orderReasons": [
{
"type": "cancellation",
"reasons": [
{
"value": "wrong_product"
},
{
"value": "defective_product"
}
]
}
]
}
}