Skip to content

Get hugggs from a transaction

Overview

GET /api/v2/transactions/{transactionId}/hugggs

This endpoint is used to retrieve all the hugggs for a given transaction.

Request

Embedded Entities

The endpoint supports embedding related entities - for a detailed overview of how this works, please read API Overview.

Relation Entity Description
message Message An entity containing the message attached to a huggg
voucher Voucher Sometimes hugggs have a voucher associated with them for redemption
voucher.segment ProductSegment Details about the generic group the huggg's voucher is part of
purchase Product The item that this huggg is for
purchase.brand Brand The brand associated with this huggg's purchase
purchase.segments ProductSegment Any generic groupings associated with the huggg's purchase
purchase.brand.stores Store All locations served by the the huggg's purchase's brand
purchase.brand.integration Integration Details about the huggg's purchase's brand's main integration method with huggg

Examples

Retrieve hugggs with messages

GET /api/v2/transactions/{transactionId}/hugggs?embed[]=message

Response

The successful response returns a paginated list of hugggs

HTTP/1.1 200 OK

{
    "current_page": 1,
    "data": [
        {
            "id": "huggg_id",
            "sender_id": "sender_id",
            "receiver_id": "receiver_id",
            "created_at": "yesterday",
            "updated_at": "2019-04-01 11:38:13",
            "purchase_id": "product_id",
            "status": 5,
            "code": "",
            "expiry_date": "2019-07-30",
            "vid": "",
            "redeem_code": "redeem_code",
            "shortcode": "short_code",
            "reminder_sent": "",
            "type": "",
            "transaction_id": "transaction_id",
            "message_id": "message_id",
            "redeemed_id": null,
            "voucher_id": null,
            "is_expired": false,
            "hug_status": "sent",
            "status_code": "SE",
            "image_url": null
        },
        { ... }
    ],
    "from": 1,
    "last_page": 1,
    "next_page_url": null,
    "path": "http://local.api.huggg.me/api/v2/transactions/transaction_id/hugggs?embed%5B0%5D=purchase&embed%5B1%5D=message",
    "per_page": 20,
    "prev_page_url": null,
    "to": 2,
    "total": 2,
    "embedded": {
        "messages": [
            {
                "id": "message_id",
                "created_at": "2019-04-01 11:38:13",
                "updated_at": "2019-04-01 11:38:13",
                "hug_id": "huggg_id",
                "message": "Testing",
                "conversation_id": "0",
                "sender_id": "sender_id"
            },
            { ... }
        ],
    }
}