← API Index

Building a profile page with the API

The profile is where a customer looks after everything that is not a single order: his data, his subscriptions, pauses, favourites, discounts and what he still owes or is owed. This skill lists the sections of the standard shop and where their data comes from, so that your own page shows the same and changes things the same way. If you only want the ready-made page, embed the profile component instead (see use-js-components).

Data you need

Two calls deliver almost everything; load them once when the page opens:

Call Delivers
api/user UserInfo (customer number, names, email, role, payment method and allowed payment methods, balance, notification settings, box count, ...), the customer's Tour and Address list, Box, Discount, bonus data and OutstandingPayment
api/dates ShopDate (with the order id of each date that has an order), Pause, Subscription, deselected items and groups, Favourite

Plus api/configuration for the shop rules (is the subscription feature on, which notification channels exist, ...) and api/order per order you want to show in detail.

Freshness. The customer data in api/user is the state of the customer's last login. After a change through api/client/setprofile the response carries the new data; changes made by the shop's back office meanwhile only show after the next login. The one exception is the list of open positions (OutstandingPayment), which is read anew on every call.

Sections

Section Shows Read from Change with
Login data customer number, email, password change UserInfo api/client/setprofile
Settings & newsletter newsletter, notification channels per event (email / SMS / push), remembered preferences UserInfo (event_notification1..8, preferences), channels from Config setprofile
Interests & promotions groups the customer can join or leave api/system/actiongroups api/client/actiongroup
Subscriptions each subscription with frequency, amount, tour Subscription, ShopDate, Pause addsubscription, changesubscription, dropsubscription
Delivery pauses pauses, optionally for the subscription only Pause, Subscription api/client/addpause, api/client/droppause
Deselected items items and groups the customer never wants to receive deselected items from api/dates api/client/dropdeselected
Favourites remembered items Favourite addfavourite, dropfavourite
Discounts discounts, vouchers, bonus points Discount, UserInfo, bonus data; campaigns from api/system/bonus/list api/client/applybonus
Box status returnable boxes still at the customer's place Box, UserInfo.boxcnt (if set, show the number rather than counting the list) -
Past orders orders with date and state; open in cart, cancel order ids from ShopDate, details from api/order api/client/cancelorder
Personal data, delivery name, title, birthday, phone, company, delivery address, tour UserInfo, Tour, Address setprofile
Payment payment method, billing address, balance, open positions (see below) UserInfo, OutstandingPayment setprofile; PayPal: api/client/ppauthorize
Delete account reasons to pick, warning about open orders and subscriptions api/system/goodbye_reasons api/logout with unregister=true and an optional message

Payment: balance and open positions

Don't forget

Ideas