api.gift_cards

/api/gift_cards/

GET /api/gift_cards/

Description:

Retrieve a summary list of all gift cards.
can_lock requires_lock has_etag requires_etag
False False False False

Filters:

Name Description
serialNumber The gift card serial number
id The gift card id

Request:

<!-- No XML Request. -->

Response:

<gift_cards>
    <gift_card uri="/gift_cards/X/" id="X" full_render="false"/>
    [...]
</gift_cards>

POST /api/gift_cards/

Description:

Create a new Gift Card
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<gift_card>
    <!-- You may specify an invoice ID or a source ID (not required and specifying both is not allowed) -->
    <invoice id="[unsigned integer]" />
    <source_id>[string]</source_id>
    <product id="[unsigned integer]" />
    <serial_number>[string]</serial_number> <!-- If the server does not generate gift card serials this tag must be present, else it must not be present -->
    <flags> <!-- optional -->
        <active>[boolean]</active>
    </flags>
    <user id="[unsigned integer]" /> <!-- optional -->
    <note>[string]</note> <!-- optional -->
    <totals> <!-- Optional -->
        <used>[decimal - max 2 decimal places]</used> <!-- Must be present if total is present -->
        <credit>[decimal - max 2 decimal places]</credit> <!-- Must be present if used and total are present -->
        <total>[decimal - max 2 decimal places]</total> <!-- Must be present if used is present -->
        <!-- You can specify credit alone, or used AND credit AND total -->
    </totals>
</gift_card>

Response:

<gift_card uri="/gift_cards/X/" id="X" full_render="true">
    <!-- See GET /gift_cards/X/ response for details. -->
</gift_card>
Expected Errors:

/api/gift_cards/(d+)/

GET /api/gift_cards/(d+)/

Description:

Retrieve the details for a single gift card.
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<gift_card uri="/gift_cards/A/" id="A" full_render="true">
    <flags>
        <active>false</active>
    </flags>
    <created>[datetime]</created>
    <modified>[datetime]</modified>
    <gift_card_id>[str]</gift_card_id>
    <user uri="/users/B/" id="B"/>
    <product uri="/products/C/" id="C"/>
    <invoice uri="/invoices/D/" id="D"/>
    <serial_number>[str]</serial_number>
    <totals>
        <total>[decimal]</total>
        <used>[decimal]</used>
        <credit>[decimal]</credit>
    </totals>
    <history_entries>
        <history uri="/gift_cards/A/history/E/" id="E" full_render="true">
            <!-- See GET /gift_cards/X/history/Y/ response for details. -->
        </history>
        [...]
    </history_entries>
</gift_card>

/api/gift_cards/(d+)/history/

GET /api/gift_cards/(d+)/history/

Description:

Return a list of history entries for a specific gift card
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<history_entries>
    <history uri="/gift_cards/X/history/Y/" id="Y" full_render="true">
        <!-- See GET /gift_cards/X/history/Y/ response for details. -->
    </history>
    [...]
</history_entries>

/api/gift_cards/(d+)/history/(d+)/

GET /api/gift_cards/(d+)/history/(d+)/

Description:

Return a specific history entry for a specific gift card
can_lock requires_lock has_etag requires_etag
False False False False

Request:

<!-- No XML Request. -->

Response:

<history uri="/gift_cards/A/history/B/" id="B" full_render="true">
    <created>[datetime]</created>
    <user uri="/users/C/" id="C"/>
    <note>[str]</note>
    <source_id>[str]</source_id>
    <totals>
        <before>[decimal]</before>
        <after>[decimal]</after>
        <amount>[decimal]</amount>
    </totals>
    <activity>[str]</activity>
</history>