FD1 Client Protocol

FD1 Get Active Sale

Requests details about a sale or sales the user is interacting with. This endpoint does not return details of completed sales. See Sales Endpoint to access completed sales. Conceptually an FD1 server can have multiple active sales, but a user is only working with a single active sale. This API returns the details of that sale.

For most salesbuilder APIs you should always include the sale key you wish to interact with in the field "k" (key). If you do not supply a key, the top active sale will be used, however the active sale may change at any stage under user control, meaning your API might not affect the sale you expected.

The output from this request is salesbuilder.active packet.

The reply data is directly in the data{}, a rows[] is not returned unless your request has qk=all See below.

The request "k" field provides the unique sale id you want details on. This may also be the following keywords

  • active To get the top most active sale. If "k" is missing, active is the default.

fd1.salesbuilder.get_sale

Locate a single active sale and return key details about it. An active sale is a concept for instore Point of Sale terminals, where the user is currently seeing one sale, even if multiple sales are open.

{
    a: "fd1.salesbuilder.get_sale"
}
Response
{
    ...
    sc: "salesbuilder.active"
    data: {
        physkey: "SALE1",
        random_key: "MCks208vfh29",
        ...
    }
}

Using HTML fetch

fetch("http://server/fd1/salesbuilder/get_sale")
.then(function (rsp) { return rsp.json() })
.then(function (obj) {
    ... obj is reply ...
})

Getting All Active Sales

{
    a:  "fd1.salesbuilder.get_sale"
    qk: "all",
    k:  "active"
}
fetch("http://server/fd1/salesbuilder/get_sale?qk=all&k=active")
.then(function (rsp) { return rsp.json() })
.then(function (obj) {
    ... obj.rows[...] is reply ...
})

Response.

{
    ...
    sc: "salesbuilder.active"
    data: {
        rows: [
            { physkey: "SALE1" ...},
            { physkey: "SALE2" ...}
        ]
    }
}