Skip to content

Edit Visit

Request

Update the attendance status, bill comment, Services, Product Items, and payments of a visit.

This is a replace operation for the whole visit. services and goods_transactions replace every Service line and every Product Item of the visit, not only those of record_id. A list that is omitted defaults to [] and deletes all its lines. There is no append. Read the visit first and echo every line exactly.

How to work with this operation

  • comment is required and overwrites the visit's bill (document) comment, not the Appointment comment. Echo the current bill comment.
  • attendance is required. When the Business User has the right to sell Products in Appointments, a status other than arrived (1) or confirmed (2) deletes every Product Item of the visit and cancels all its payments.
  • services must list every Service line of every Appointment of the visit, each with its record_id; a line without record_id returns 422. An Appointment whose lines are missing loses them, and a changed set of Services sends the Booking User a "record changed" message.
  • goods_transactions must list every Product Item of the visit. A line with id updates that line, a line without id is created, and an existing line that is not sent is deleted together with any gift card or membership it issued.
  • Without the right to sell Products in Appointments, goods_transactions is ignored and the request still returns 200. Read the visit back to confirm the change. This operation does not check the finer Product rights (create, edit, price, discount, and their day limits) that Save Visit Appointments enforces.
  • A printed sale bill refuses Product Item changes (400), and refuses deleted_transaction_ids (422).
  • When the Location forbids negative stock, a line that would take an Inventory below zero returns 406. Otherwise stock may go negative.
  • A gift card line needs good_special_number unless its type allows an empty code. A membership whose type expires on a specific date needs good_planned_activation_date. Echo both for existing gift card and membership lines; otherwise the save fails or re-issues them.
  • Product Item changes re-apply the Booking User's loyalty discount programs to the visit. Send cost from the read's manual_cost, never from the read's cost, which already includes loyalty discounts and would be discounted twice. Read the lines back after the save.
  • Every save sends the partner webhook "record update" for the Appointments of the visit.
Security
BearerPartnerUser
Path
visit_idnumberrequired
Example:12345
record_idnumberrequired
Example:67890
Headers
Acceptstringrequired

e.g. application/vnd.api.v2+json

Example:application/vnd.api.v2+json
Content-Typestringrequired

application/json

Authorizationstringrequired

Bearer partner_token, User user_token

Body*/*required
attendancenumberrequired

Visit status (2 - The user confirmed the appointment, 1 - The user came, the services were provided, 0 - the user is waiting, -1 - the user did not show)

Example:1
commentstringrequired

A comment

Example:""
new_transactionsArray of objects

Array of objects of new commodity transactions

deleted_transaction_idsArray of integers

IDs of visit payments (financial transactions) to delete. Applied only with the Appointment finances right and without fast_payment.

goods_transactionsArray of objects

Every Product Item of the visit. The list replaces the visit's Product Items: send each existing line with its id, add a line without id to create it, and leave a line out to delete it.

Example:
[ { "id": 2168657, "good_id": 232658, "amount": 1, "price": 15, "discount": 20, "cost": 12, "operation_unit_type": 1, "master_id": 55436, "storage_id": 91303 }, { "good_id": 232659, "amount": 2, "price": 10, "discount": 0, "cost": 20, "operation_unit_type": 1, "master_id": 55436, "storage_id": 91303 } ]
servicesArray of objects

Every Service line of every Appointment of the visit. The list replaces the visit's Service lines; an Appointment whose lines are missing loses them.

Example:
[ { "id": 389045, "record_id": 10403702, "first_cost": 300, "discount": 15, "cost": 255, "amount": 1 } ]
fast_paymentnumber

Quick payment 1 - cash, 2 - cashless, 129 - cash and print, 130 - cashless and print

curl -i -X PUT \
  https://developer.alteg.io/_mock/en/b2b-v1/openapi/visits/12345/67890 \
  -H 'Accept: application/vnd.api.v2+json' \
  -H 'Authorization: Bearer <YOUR_Bearer {PartnerToken}, User {UserToken}_HERE>' \
  -H 'Content-Type: */*' \
  -d '{
    "attendance": 1,
    "comment": "",
    "goods_transactions": [
      {
        "id": 2168657,
        "good_id": 232658,
        "amount": 1,
        "price": 15,
        "discount": 20,
        "cost": 12,
        "operation_unit_type": 1,
        "master_id": 55436,
        "storage_id": 91303
      },
      {
        "good_id": 232659,
        "amount": 2,
        "price": 10,
        "discount": 0,
        "cost": 20,
        "operation_unit_type": 1,
        "master_id": 55436,
        "storage_id": 91303
      }
    ],
    "services": [
      {
        "id": 389045,
        "record_id": 10403702,
        "first_cost": 300,
        "discount": 15,
        "cost": 255,
        "amount": 1
      }
    ]
  }'

Responses

OK

Response
No content