admin-affiliate

Apply an affiliate-link recommendation to one component and country

Upserts the single affiliate_links row for (componentId, country) with the PocketBase superuser client: the first matching row is updated, otherwise a row is created. country defaults to universal.

Per actionType:

  • use_existing_url (needs preferredUrl) and search_and_apply (needs researchedUrl) store the expanded URL with unavailable: false. A bare 10-character ASIN becomes a product URL on the country's Amazon marketplace (buildProductUrl); any other URL gets that marketplace's affiliate tag (applyRegionalTag). universal uses the de marketplace.
  • mark_unavailable stores url: null, unavailable: true.
  • delete_link deletes the affiliate_links record linkId (its country is not checked).
  • keep_search_fallback writes nothing.
  • manual_review and keep_external are rejected with 400.

componentId is required for every action, including delete_link. componentName, unavailable and searchQuery are accepted and ignored.

post/api/admin/affiliate-apply

Request

  • Base URL: https://voltplan.app
  • URL: https://voltplan.app/api/admin/affiliate-apply
  • Auth: HTTP bearer

Request body

componentIdstring required

Id of the components record.

componentNamestring

Accepted, not read.

country'universal' | 'de' | 'us' | 'uk' | 'fr' | 'es' | 'it' | 'au'
unavailableboolean

Accepted, not read; use actionType: mark_unavailable.

actionType'use_existing_url' | 'search_and_apply' | 'keep_search_fallback' | 'keep_external' | 'manual_review' | 'mark_unavailable' | 'delete_link' required
preferredUrlstring

ASIN or URL; required for use_existing_url.

researchedUrlstring

ASIN or URL; required for search_and_apply.

searchQuerystring

Accepted, not read.

linkIdstring

Id of the affiliate_links record; required for delete_link.

Response

Recommendation applied.

successunknown required
mode'existing' | 'search_result' | 'unavailable' | 'search_fallback' | 'deleted' required

use_existing_url → existing, search_and_apply → search_result, mark_unavailable → unavailable, keep_search_fallback → search_fallback, delete_link → deleted.

urlstring

Stored URL; only for existing and search_result.

country'universal' | 'de' | 'us' | 'uk' | 'fr' | 'es' | 'it' | 'au'

Absent for deleted.

Changes

No recorded changes to this operation across all 1 revision of this API.