API

If you ever need to add registrations or serial numbers programatically, there is an API for it.

Generate Access Token

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

Usage

Registrations - add new (POST)

Once the access token is generated, it can be use to register a new product

  1. Make an HTTP POST request to the endpoint - https://product-reg.varify.xyz/api/registrations

  2. The POST request should have the following JSON payload

{
    "accessToken": "12323213123",
    "registrations": [
        {
            "productName": "MacBook 2018",
            "customerEmail": "tom@example.com",
            "customerName": "Tom Delong",
            "serialNumbers": [
                "123",
                "321"
            ],
            "purchaseDate": "2019-01-01",
            "extraFields": {
                "extra_field_name_in_lower_case": "extra_field_value",
                "extra_field_name_in_lower_case_2": "extra_field_value_2",
            }
        }
    }

It's possible to register multiple products in one call - simply add another registration object to the registrations array.

If there are extra fields - make sure the extra field name is used and it's in lowercase

Extra field name - this can be found in the webhook payload or admin extra fields (make sure its exact name in lowercase)

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. Make a HTTP PUT request to the endpoint - https://product-reg.varify.xyz/api/registration/:regId

  2. The PUT request should have the following JSON payload

{
    "accessToken": "12323213123",
    "registration": {
            "productName": "MacBook 2018",
            "customerEmail": "tom@example.com",
            "customerName": "Tom Delong",
            "serialNumbers": [
                "123",
                "321"
            ],
            "purchaseDate": "2019-01-01",
            "extraFields": {
                "extra_field_name_in_lower_case": "extra_field_value",
                "extra_field_name_in_lower_case_2": "extra_field_value_2",
            }
    }
}

If there are extra fields - make sure the extra field name is used and it's in lowercase

Serial Numbers

Here is example the payload for adding serial numbers

{
    "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

Last updated