Links

API

If you ever need to add registrations or serial numbers programmatically, there is an API for it.
The access token can either put in the Authorization header or in the body

Generate Access Token

Access token can be obtain in the Shopify Admin > Apps > My Product Registration > Settings > General > API Access token > Generate

Usage

Registrations - add new (POST)

Once the access token is generated, it can be use to register a new product
  1. 1.
    Make an HTTP POST request to the endpoint - https://product-reg.varify.xyz/api/registrations
  2. 2.
    The POST request should have the following JSON payload
{
"accessToken": "12323213123",
"registrations": [
{
"productName": "MacBook 2018",
"customerEmail": "[email protected]",
"customerName": "Tom Delong",
"serialNumbers": [
"123",
"321"
],
"purchaseDate": "2019-01-01",
"greetings": "hello world!",
}
]
}
It's possible to register multiple products in one call - simply add another registration object to the registrations array.
If need to add data to different form e.g not the default product-registration, a new key will needed add to the registration "type": "form-slug-name", then form slug name can be found in the Form > View on frontend
If there are extra fields just add those field as key within registration, the key name can be found in the form's design and field options

Registrations - Modify existing registration (PUT)

Once the access token is generated, it can be used to modify existing registration (the registration id can be found in the admin or via the webhook payload)
  1. 1.
    Make a HTTP PUT request to the endpoint - https://product-reg.varify.xyz/api/registrations/:regId
  2. 2.
    The PUT request should have the following JSON payload
{
"accessToken": "12323213123",
"registration": {
"productName": "MacBook 2018",
"customerEmail": "[email protected]",
"customerName": "Tom Delong",
"serialNumbers": [
"123",
"321"
],
"purchaseDate": "2019-01-01",
"fields": {
"greetings": "hello agaiin",
}
}
}
If there are extra fields need to update, then put it under fields key

Registrations - Get customer's registrations

  1. 1.
    make a HTTP GET request to the endpoint /api/[email protected], the email must be in the query string
  2. 2.
    It will return all customer's registrations

Serial Numbers

Here is example the payload for adding serial numbers (POST)
  1. 1.
    Make a HTTP POST request to the endpoint /api/serial_numbers
  2. 2.
    The POST request should have the following JSON payload
{
"accessToken": "12323213123",
"serialNumbers": [
{
"serialNumber": "22018",
"sku": "mac123",
"customerTags": "VIP,mac",
}
}
The customerTags is a comma-separated of tags you want to tag the customer who register this serial number

Get a unused/unregistered serial number (GET)

You can get a random unregistered serial number
  1. 1.
    Make a HTTP GET request to the endpoint /api/serial_number
  2. 2.
    It will return a random unregistered serial number if there is one with status 200
  3. 3.
    If there is no unregistered seiral number, it wil return 204

Get a serial number (GET)

Getting information of a serial number
  1. 1.
    make a HTTP GET request to the endpoint /api/serial_numbers/test123, test123 is a serial number
  2. 2.
    It will return the serial number info if there is one
  3. 3.
    if there is no such serial number, it will return 204