Skip to content

Latest commit

 

History

History
377 lines (339 loc) · 11.8 KB

pusher.adoc

File metadata and controls

377 lines (339 loc) · 11.8 KB

Pusher service API

Service Description

Pusher is a service that pushes information to other services, currently only supporting Webhooks. Webhooks allows you to build or set up integrations which subscribe to certain events.

Create a webhook subscription

POST /organizations/{organizationUuid}/subscriptions

{
  "uuid": "<UUID1>",
  "transportName": "WEBHOOK",
  "eventNames": [],
  "destination": "https://yoururl.domain",
  "contactEmail": "[email protected]"
}

Clarification

uuid: A uuid has to be created by the called and must be UUID version 1.

transportName: only WEBHOOK is available at the moment.

eventNames: [] subscribes to all events. If you want to be more specific pick one or more from this list:

    PurchaseCreated
    ProductCreated
    ProductUpdated
    ProductDeleted
    InventoryTrackingStarted
    InventoryBalanceChanged
    InventoryTrackingStopped
    OrganizationUpdated

in the form: `"eventNames" : ["PurchaseCreated","ProductCreated"] ` etc.

destination : The destination of the messages.

contactEmail: If the webhook fails we will automatically send an email to this address, so make sure it goes to the correct person.

When you create a webhook a TestMessage will be sent with the following format:

{
  "eventName" : "TestMessage",
  "organizationUuid" : "<organization uuid>",
  "messageId" : "<unique id of the message>",
  "payload" : { "data" : "payload" }
}

We expect that this will return a 200 OK to continue with the setup.

Managing Webhook Subscriptions

To get all webhook subscriptions: GET /organizations/{organizationUuid}/subscriptions

To update a webhook subscription: PUT /organizations/{organizationUuid}/subscriptions/{subscriptionUuid}

{
  "eventNames": [],
  "destination": "https://yoururl.domain",
  "contactEmail": "[email protected]"
}

All fields are optional, only the field(s) that wish to be updated need to be included. A PUT-request will reactivate the subscription if it has failed.

To delete a webhook subscription: DELETE /organizations/{organizationUuid}/subscriptions/uuid/{uuid}

Payload

The payload is wrapped in the following json format:

  {
    "organizationUuid" : "<organization uuid>",
    "eventName" : "<one of the eventnames>",
    "messageId" : "<unique id of the message>",
    "payload": {
      "specific payload of the event"
    }
  }

Payload for the events

Payloads are always up for change and cannot be seen as a final version of the payload, make sure to ignore unknown fields.

Some example payloads:
{
  "eventName" : "InventoryTrackingStarted",
  "organizationUuid" : "0f60dbc0-fab5-11e7-b884-62da5a369555",
  "messageId" : "52662705-98de-588c-810b-75d274d6fa8b",
  "payload" : {
    "organizationUuid" : "0f60dbc0-fab5-11e7-b884-62da5a369555",
    "productUuid" : "18380ac0-fab5-11e7-94b4-842bd3fbd22c",
    "created" : {
      "uuid" : "0f674460-fab5-11e7-a310-0002ebd6a43c",
      "timestamp" : "2018-01-16T12:02:16.569+0000",
      "userType" : "USER"
    }
  }
}
{
  "eventName" : "InventoryBalanceChanged",
  "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
  "messageId" : "840108b7-6097-558d-b2d6-5a6e73f31c55",
  "payload" : {
    "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
    "balanceBefore" : [ {
      "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
      "locationUuid" : "1bfc07a0-fb65-11e7-8d72-68a12b957f8b",
      "productUuid" : "24134200-fb65-11e7-8b46-39368d314702",
      "variantUuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
      "balance" : "0"
    } ],
    "balanceAfter" : [ {
      "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
      "locationUuid" : "1bfc07a0-fb65-11e7-8d72-68a12b957f8b",
      "productUuid" : "24134200-fb65-11e7-8b46-39368d314702",
      "variantUuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
      "balance" : "10"
    } ]
  }
}
{
  "eventName" : "InventoryTrackingStopped",
  "organizationUuid" : "79fc0e90-fa02-11e7-baa2-1c9437e84b05",
  "messageId" : "40d2cfc9-38cb-5ab2-9940-9d1ff8a1ce2c",
  "payload" : {
    "organizationUuid" : "79fc0e90-fa02-11e7-baa2-1c9437e84b05",
    "productUuid" : "824ca870-fa02-11e7-a16d-9c13a3bacd8f",
    "changeInformation" : {
      "uuid" : "79ff9100-fa02-11e7-8c58-b2c0f2895e51",
      "timestamp" : "2018-01-15T14:43:54.807+0000",
      "userType" : "USER"
    }
  }
}
{
  "eventName" : "ProductDeleted",
  "organizationUuid" : "0f60dbc0-fab5-11e7-b884-62da5a369555",
  "messageId" : "46944860-8193-5df7-97d8-1ab76d9b72f1",
  "payload" : {
    "uuid" : "18380ac0-fab5-11e7-94b4-842bd3fbd22c",
    "organizationUuid" : "0f60dbc0-fab5-11e7-b884-62da5a369555",
    "name" : "newName",
    "description" : "GVDT XPWORW ISXAVFZ JKA CCIVREY QRGMQXA HXPSGT PF CT JBVECH IOHD QXYX XFVNBX AD VITQNQ WGNOIPP POVVF CHQJHTJ AMXXOOM FPFEV ",
    "presentation" : {
      "imageUrl" : "http://image.izettletest.com/productimage/l/NRBIFJYS.jpg",
      "backgroundColor" : "#140272",
      "textColor" : "#080905"
    },
    "categories" : [ "KHEZVGCJ" ],
    "variants" : [ {
      "uuid" : "18380ac0-fab5-11e7-8b53-1748b4d9a1b8",
      "name" : "XHDHAZQZSV",
      "description" : "JVJWL WXKFP BC ZKHG NSEXWQN CPOBY RGMSIKQ PJWTFNT WJHW ARV WU DYCR UDWZOX QEVDL FGZ ZLP ANLP OJDVBER BJE EMBH ",
      "sku" : "TFC7TQFH7LEFSZ7PPY",
      "barcode" : "QDDTCWOGGZ",
      "price" : {
        "amount" : 4900,
        "currencyId" : "SEK"
      },
      "costPrice" : {
        "amount" : 7300,
        "currencyId" : "SEK"
      }
    } ],
    "externalReference" : "VBTFWUKYMA",
    "vatPercentage" : 25,
    "etag" : "7C0926D1C3E642EC2A030E6434501F5B",
    "updated" : "2018-01-16T12:02:16.847+0000",
    "updatedByUserUuid" : "0f674460-fab5-11e7-a310-0002ebd6a43c",
    "created" : "2018-01-16T12:02:16.101+0000",
    "createdByUserUuid" : "0f674460-fab5-11e7-a310-0002ebd6a43c"
  }
}
{
  "eventName" : "ProductCreated",
  "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
  "messageId" : "699730fe-fab4-516f-a48e-6227e9d7a835",
  "payload" : {
    "uuid" : "24134200-fb65-11e7-8b46-39368d314702",
    "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
    "name" : "GBRNOTYI",
    "description" : "CSINH CD ZWR EKTWJ OMYGXV BP JNVQS CF OAMTIS UPZQ YZC QH LAX EZYCBCY NKQUNOK TK FAQCXO XJPBLL ZP UNHVWFI ",
    "presentation" : {
      "imageUrl" : "http://image.izettle.com/productimage/l/GAdasdaBXTC.jpg",
      "backgroundColor" : "#804619",
      "textColor" : "#408384"
    },
    "categories" : [ "GDOCJKIQ" ],
    "variants" : [ {
      "uuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
      "name" : "SXTDESFYPA",
      "description" : "VOYLECG TGEBKQT WSTG PIV EIZ LG MPDXVU XKGPEF VA MVJYWA IKZCQ FQGJHR XPDXM MVS HMBHN KRERY SWQ NQPQIL MGNP SLW ",
      "sku" : "SGRZ8SK5EJTBT018H4",
      "barcode" : "7AIRNAB1KF",
      "price" : {
        "amount" : 8300,
        "currencyId" : "SEK"
      },
      "costPrice" : {
        "amount" : 9800,
        "currencyId" : "SEK"
      }
    } ],
    "externalReference" : "VCKWGHFISF",
    "vatPercentage" : 25,
    "etag" : "2FB3091638C71D1D2A39C86936675F96",
    "updated" : "2018-01-17T09:02:27.423+0000",
    "updatedByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920",
    "created" : "2018-01-17T09:02:27.423+0000",
    "createdByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920"
  }
}
{
  "eventName" : "ProductUpdated",
  "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
  "messageId" : "1c93a601-1420-5c05-b0ba-f4d80743c55f",
  "payload" : {
    "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
    "newEntity" : {
      "uuid" : "24134200-fb65-11e7-8b46-39368d314702",
      "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
      "name" : "newName",
      "description" : "CSINH CD ZWR EKTWJ OMYGXV BP JNVQS CF OAMTIS UPZQ YZC QH LAX EZYCBCY NKQUNOK TK FAQCXO XJPBLL ZP UNHVWFI ",
      "presentation" : {
        "imageUrl" : "http://image.izettle.com/productimage/l/GdasdadXTC.jpg",
        "backgroundColor" : "#804619",
        "textColor" : "#408384"
      },
      "categories" : [ "GDOCJKIQ" ],
      "variants" : [ {
        "uuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
        "name" : "SXTDESFYPA",
        "description" : "VOYLECG TGEBKQT WSTG PIV EIZ LG MPDXVU XKGPEF VA MVJYWA IKZCQ FQGJHR XPDXM MVS HMBHN KRERY SWQ NQPQIL MGNP SLW ",
        "sku" : "SGRZ8SK5EJTBT018H4",
        "barcode" : "7AIRNAB1KF",
        "price" : {
          "amount" : 8300,
          "currencyId" : "SEK"
        },
        "costPrice" : {
          "amount" : 9800,
          "currencyId" : "SEK"
        }
      } ],
      "externalReference" : "VCKWGHFISF",
      "vatPercentage" : 25,
      "etag" : "12653006ECD3FA21EB086FFBB4AB0D01",
      "updated" : "2018-01-17T09:02:27.680+0000",
      "updatedByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920",
      "created" : "2018-01-17T09:02:27.423+0000",
      "createdByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920"
    },
    "oldEntity" : {
      "uuid" : "24134200-fb65-11e7-8b46-39368d314702",
      "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
      "name" : "GBRNOTYI",
      "description" : "CSINH CD ZWR EKTWJ OMYGXV BP JNVQS CF OAMTIS UPZQ YZC QH LAX EZYCBCY NKQUNOK TK FAQCXO XJPBLL ZP UNHVWFI ",
      "presentation" : {
        "imageUrl" : "http://image.izettle.com/productimage/l/GAdasdasdBXTC.jpg",
        "backgroundColor" : "#804619",
        "textColor" : "#408384"
      },
      "categories" : [ "GDOCJKIQ" ],
      "variants" : [ {
        "uuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
        "name" : "SXTDESFYPA",
        "description" : "VOYLECG TGEBKQT WSTG PIV EIZ LG MPDXVU XKGPEF VA MVJYWA IKZCQ FQGJHR XPDXM MVS HMBHN KRERY SWQ NQPQIL MGNP SLW ",
        "sku" : "SGRZ8SK5EJTBT018H4",
        "barcode" : "7AIRNAB1KF",
        "price" : {
          "amount" : 8300,
          "currencyId" : "SEK"
        },
        "costPrice" : {
          "amount" : 9800,
          "currencyId" : "SEK"
        }
      } ],
      "externalReference" : "VCKWGHFISF",
      "vatPercentage" : 25,
      "etag" : "2FB3091638C71D1D2A39C86936675F96",
      "updated" : "2018-01-17T09:02:27.423+0000",
      "updatedByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920",
      "created" : "2018-01-17T09:02:27.423+0000",
      "createdByUserUuid" : "1b881020-fb65-11e7-bcf2-692e23651920"
    }
  }
}
{
  "eventName" : "PurchaseCreated",
  "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
  "messageId" : "29248ab5-06e6-58dd-8aad-d86c15859e19",
  "payload" : {
    "purchaseUuid" : "244f60a0-fb65-11e7-ae57-406959a78d8a",
    "source" : "POS",
    "userUuid" : "1b881020-fb65-11e7-bcf2-692e23651920",
    "currency" : "SEK",
    "country" : "SE",
    "amount" : 8300,
    "vatAmount" : 21,
    "timestamp" : 1516179747754,
    "created" : "2018-01-17T09:02:27.754+0000",
    "gpsCoordinates" : {
      "longitude" : 10.0,
      "latitude" : 10.0,
      "accuracyMeters" : 10.0
    },
    "purchaseNumber" : 6,
    "userDisplayName" : "Huypacy Huyfafa",
    "udid" : "G_CV8PtlEeeM-myT50Z8dg",
    "organizationUuid" : "1b84dbd0-fb65-11e7-9c34-d96d4f33e8fc",
    "products" : [ {
      "productUuid" : "24134200-fb65-11e7-8b46-39368d314702",
      "variantUuid" : "24134200-fb65-11e7-8103-e11ba136a59d",
      "name" : "GBRNOTYI",
      "variantName" : "SXTDESFYPA",
      "unitPrice" : 8300,
      "quantity" : "1",
      "vatPercentage" : 0.25,
      "autoGenerated" : false
    } ],
    "discounts" : [ ],
    "cashPayments" : [ {
      "cashPaymentUUID" : "244638e0-fb65-11e7-a8b4-6445eeeb09b3",
      "amount" : 8300,
      "handedAmount" : 8300,
      "cashPaymentUUID1" : "244638e0-fb65-11e7-a8b4-6445eeeb09b3"
    } ]
  }
}