A példa két módosítást mutat. Az első lekéri a partnert, és csak a címét cseréli, így a telefonszám és az e-mail cím megmarad. A második csak a nevet és a címet küldi, ezért a Billingo kiüríti a többi mezőt.
Teljes csere: a lekért partnerrel minden megmarad, a csonka PUT kiüríti a telefont és az e-mailt.
Futtatás a sandboxbanimport { } from 'tarcajs'
const = ()
const = await ..({
: 'Vevő Kft.',
: { : '1111', : 'Budapest', : 'Fő utca 1.' },
: ['vevo@example.hu'],
: '+36 1 234 5678',
})
const = . ?? 0
const { : , ... } = await ..()
const = await ..(, {
...,
: { ...., : '1052', : 'Váci utca 10.' },
})
.('teljes partnerrel:', .., ., .)
const = await ..(, {
: 'Vevő Kft.',
: { : '1052', : 'Budapest', : 'Váci utca 10.' },
})
.('csak névvel és címmel:', .(.), .)POST /partners HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [
"vevo@example.hu"
],
"phone": "+36 1 234 5678"
}GET /partners/1 HTTP/1.1PUT /partners/1 HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1052",
"city": "Budapest",
"address": "Váci utca 10."
},
"emails": [
"vevo@example.hu"
],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "+36 1 234 5678",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}PUT /partners/1 HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1052",
"city": "Budapest",
"address": "Váci utca 10."
}
}HTTP/1.1 201
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [
"vevo@example.hu"
],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "+36 1 234 5678",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 200
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [
"vevo@example.hu"
],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "+36 1 234 5678",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 200
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1052",
"city": "Budapest",
"address": "Váci utca 10."
},
"emails": [
"vevo@example.hu"
],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "+36 1 234 5678",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 200
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1052",
"city": "Budapest",
"address": "Váci utca 10."
},
"emails": [],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}teljes partnerrel: Váci utca 10. +36 1 234 5678 [ 'vevo@example.hu' ]
csak névvel és címmel: "" []Az Elküldött kérések fülön hasonlítsd össze a két UpdatePartner törzset: az első a teljes partnert viszi, a második csak két mezőt. A Billingo válasz fülön a második csere után a phone "", az emails [].