Webhooks API

Last updated: Aug 2nd, 2018
Watch Star

Products

Your endpoint should support this rules:

List products

You need to build an http server endpoint that when asked for a request similar to this:

GET https://www.example.com/your/endpoint/url?offset=0&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

Or with cursor pagination strategy if numeric offset is not an option for pagination:

GET https://www.example.com/your/endpoint/url?next=YXNkaWhhc3BvZGhpYXM&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

returns a paginated result with the following JSON structure:

{
  "paging": {
    "pageSize": 20,
    "itemsTotal": 2,
    "offset": 0
  },
  "products": [
    {
      "_id": "100004777",
      "sku": "100004777",
      "last_updated": 1517360038797,
      "title": "EON618S JBL SUBWOOFER 18\" AMPLIFICADO",
      "url": "",
      "brand": "",
      "mpn": "",
      "model": "",
      "description": "JBL Premium Transducers",
      "variations": [
        {
          "availabilities": [
            {
              "tag": "default",
              "quantity": 50
            }
          ],
          "prices": [
            {
              "tag": "default",
              "currency": "USD",
              "number": 1060.51
            }
          ],
          "images": [
            {
              "url": "https://www.example.com/13080-thickbox_default/eon618s-jbl-subwoofer-18-amplificado-.jpg"
            }
          ],
          "videos": [
            {
              "url": ""
            }
          ],
          "barcode": "",
          "size": "",
          "color": "",
          "variationid": ""
        }
      ],
      "properties": [
        {
          "extraattributes": {
            "promociones": "",
            "status": "",
            "condicion_venta": "",
            "peso": "",
            "relacionados": "",
            "custom_01": "",
            "custom_02": "1",
            "custom_03": ""
          }
        }
      ]
    },
    {
      "_id": "100004777",
      "sku": "100004777",
      "last_updated": 1517360038797,
      "title": "EON618S JBL SUBWOOFER 18\" AMPLIFICADO",
      "url": "",
      "brand": "",
      "mpn": "",
      "model": "",
      "description": "JBL Premium Transducers",
      "variations": [
        {
          "availabilities": [
            {
              "tag": "default",
              "quantity": 50
            }
          ],
          "prices": [
            {
              "tag": "default",
              "currency": "USD",
              "number": 1060.51
            }
          ],
          "images": [
            {
              "url": "https://www.example.com/13080-thickbox_default/eon618s-jbl-subwoofer-18-amplificado-.jpg"
            }
          ],
          "videos": [
            {
              "url": ""
            }
          ],
          "barcode": "",
          "size": "",
          "color": "",
          "variationid": ""
        }
      ],
      "properties": [
        {
          "extraattributes": {
            "promociones": "",
            "status": "",
            "condicion_venta": "",
            "peso": "",
            "relacionados": "",
            "custom_01": "",
            "custom_02": "1",
            "custom_03": ""
          }
        }
      ]
    }
  ]
}
List product by id

Sometimes for performance reasons it is better to just send the list of ids with its last_updated times so Click2Sync can understand faster what needs to be updated on Click2Sync.

In this case you can respond with the same request url

GET https://www.example.com/your/endpoint/url?offset=0&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

Or with cursor pagination strategy if numeric offset is not an option for pagination:

GET https://www.example.com/your/endpoint/url?next=YXNkaWhhc3BvZGhpYXM&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

But with a format similar to this:


{
  "paging": {
    "pageSize": 20,
    "itemsTotal": 2,
    "offset": 0
  },
  "products": [
    {
      "_id": "100004777",
      "sku": "100004777",
      "last_updated": 1517360038797
    },
    {
      "_id": "100004777",
      "sku": "100004777",
      "last_updated": 1517360038797
    }
  ]
}

And you need to have a way to respond the complete version of the product when it needs to crawl it

GET https://www.example.com/your/endpoint/url?id=100004777&jobid=123
C2SKey: {{API KEY}}


{
  "_id": "100004777",
  "sku": "100004777",
  "last_updated": 1517360038797,
  "title": "EON618S JBL SUBWOOFER 18\" AMPLIFICADO",
  "url": "",
  "brand": "",
  "mpn": "",
  "model": "",
  "description": "JBL Premium Transducers",
  "variations": [
    {
      "availabilities": [
        {
          "tag": "default",
          "quantity": 50
        }
      ],
      "prices": [
        {
          "tag": "default",
          "currency": "USD",
          "number": 1060.51
        }
      ],
      "images": [
        {
          "url": "https://www.example.com/13080-thickbox_default/eon618s-jbl-subwoofer-18-amplificado-.jpg"
        }
      ],
      "videos": [
        {
          "url": ""
        }
      ],
      "barcode": "",
      "size": "",
      "color": "",
      "variationid": ""
    }
  ],
  "properties": [
    {
      "extraattributes": {
        "promociones": "",
        "status": "",
        "condicion_venta": "",
        "peso": "",
        "relacionados": "",
        "custom_01": "",
        "custom_02": "1",
        "custom_03": ""
      }
    }
  ]
}

Add/Update products

You need to build an http server endpoint that when asked for a request similar to this:

POST https://wwww.example.com/your/endpoint/url?jobid=123&id=999999
C2SKey: {{API KEY}}

{
  "_id": "999999",
  "sku": "999999",
  "last_updated": 1517360038797,
  "title": "EON618S JBL SUBWOOFER 18\" AMPLIFICADO",
  "url": "",
  "brand": "",
  "mpn": "",
  "model": "",
  "description": "JBL Premium Transducers",
  "variations": [
    {
      "availabilities": [
        {
          "tag": "default",
          "quantity": 50
        }
      ],
      "prices": [
        {
          "tag": "default",
          "currency": "USD",
          "number": 1060.51
        }
      ],
      "images": [
        {
          "url": "https://www.example.com/13080-thickbox_default/eon618s-jbl-subwoofer-18-amplificado-.jpg"
        }
      ],
      "videos": [
        {
          "url": ""
        }
      ],
      "barcode": "",
      "size": "",
      "color": "",
      "variationid": ""
    }
  ],
  "properties": [
    {
      "extraattributes": {
        "promociones": "",
        "status": "",
        "condicion_venta": "",
        "peso": "",
        "relacionados": "",
        "custom_01": "",
        "custom_02": "1",
        "custom_03": ""
      }
    }
  ]
}

executes the "INSERT/UPDATE" operation on the external data storage, database, application, etc. and if succeeds returns the created object with the following JSON structure:

{
  "success": true,
  "code": 200,
  "warnings": [],
  "product": {
    "_id": "100004777",
    "sku": "100004777",
    "last_updated": 1517360038797,
    "title": "EON618S JBL SUBWOOFER 18\" AMPLIFICADO",
    "url": "",
    "brand": "",
    "mpn": "",
    "model": "",
    "description": "JBL Premium Transducers",
    "variations": [
      {
        "availabilities": [
          {
            "tag": "default",
            "quantity": 50
          }
        ],
        "prices": [
          {
            "tag": "default",
            "currency": "USD",
            "number": 1060.51
          }
        ],
        "images": [
          {
            "url": "https://www.example.com/13080-thickbox_default/eon618s-jbl-subwoofer-18-amplificado-.jpg"
          }
        ],
        "videos": [
          {
            "url": ""
          }
        ],
        "barcode": "",
        "size": "",
        "variationid": ""
      }
    ],
    "properties": [
      {
        "extraattributes": {
          "promociones": "",
          "status": "",
          "condicion_venta": "",
          "peso": "",
          "relacionados": "",
          "custom_01": "",
          "custom_02": "1",
          "custom_03": ""
        }
      }
    ]
  }
}

if it fails returns the response object with the following JSON structure:

{
  "success": false,
  "code": 400,
  "error": "Could not upsert product",
  "reasons":[
    {
      "msg": "Invalid price zero"
    },
    {
      "msg": "Invalid repeated title"
    },
    {
      "msg": "Invalid images"
    }
  ],
  "warnings": []
}
List Orders

You need to build an http server endpoint that when asked for a request similar to this

GET https://wwww.example.com/your/endpoint/url?offset=0&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

Or with cursor pagination strategy if numeric offset is not an option for pagination:

GET https://wwww.example.com/your/endpoint/url?next=YXNkaWhhc3BvZGhpYXM&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

returns a paginated result with the following JSON structure:

{
  "paging": {
    "pageSize": 20,
    "itemsTotal": 1,
    "offset": 0
  },
  "orders": [
    {
      "_id": "75554554546",
      "orderid": "75554554546",
      "last_updated": 1517360038797,
      "status": "paid",
      "dateCreated": "",
      "dateClosed": "",
      "total": {
        "amount": 350,
        "currency": "USD"
      },
      "orderItems": [
        {
          "id": "7778545",
          "variation_id": "0",
          "quantity": 1,
          "unitPrice": 350,
          "currencyId": "USD"
        }
      ],
      "buyer": {
        "id": "4578889",
        "email": "testbuyer@example.com",
        "phone": "88888888",
        "firstName": "John",
        "lastName": "Doe",
        "billingaddress": {
          "addressline": "",
          "zipcode": "",
          "city": "",
          "state": "",
          "country": ""
        },
        "shipmentaddress": {
          "addressline": "",
          "zipcode": "",
          "city": "",
          "state": "",
          "country": ""
        }
      },
      "shipments":[
        {
          "id": "123",
          "shiptracknum": "TRK-1203912",
          "shipitems": ["4578889"],
          "shiptype": "Fedex",
          "shipstatus": "shipping"
        }
      ],
      "rating": 2.5,
      "feedback": "",
      "messages": [
        {
          "message_id": "",
          "date_created": 0,
          "from": "",
          "message": ""
        }
      ]
    }
  ]
}

List order by id

Sometimes for performance reasons it is better to just send the list of ids with its last_updated times so Click2Sync can understand faster what needs to be updated on Click2Sync.

In this case you can respond with the same request url

GET https://www.example.com/your/endpoint/url?offset=0&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

Or with cursor pagination strategy if numeric offset is not an option for pagination:

GET https://www.example.com/your/endpoint/url?next=YXNkaWhhc3BvZGhpYXM&sortorder=desc&jobid=123
C2SKey: {{API KEY}}

But with a format similar to this:


{
  "paging": {
	"pageSize": 20,
	"itemsTotal": 2,
	"offset": 0
  },
  "orders": [
	{
	  "_id": "75554554546",
	  "orderid": "75554554546",
	  "last_updated": 1517360038797
	},
	{
	  "_id": "75554554546",
	  "orderid": "75554554546",
	  "last_updated": 1517360038797
	}
  ]
}

And you need to have a way to respond the complete version of the order when it needs to crawl it

GET https://www.example.com/your/endpoint/url?id=75554554546&jobid=123
C2SKey: {{API KEY}}


{
  "_id": "75554554546",
  "orderid": "75554554546",
  "last_updated": 1517360038797,
  "status": "paid",
  "dateCreated": "",
  "dateClosed": "",
  "total": {
    "amount": 350,
    "currency": "USD"
  },
  "orderItems": [
    {
      "id": "7778545",
      "variation_id": "0",
      "quantity": 1,
      "unitPrice": 350,
      "currencyId": "USD"
    }
  ],
  "buyer": {
    "id": "4578889",
    "email": "testbuyer@example.com",
    "phone": "88888888",
    "firstName": "John",
    "lastName": "Doe",
    "billingaddress": {
      "addressline": "",
      "zipcode": "",
      "city": "",
      "state": "",
      "country": ""
    },
    "shipmentaddress": {
      "addressline": "",
      "zipcode": "",
      "city": "",
      "state": "",
      "country": ""
    }
  },
  "shipments":[
    {
      "id": "123",
      "shiptracknum": "TRK-1203912",
      "shipitems": ["4578889"],
      "shiptype": "Fedex",
      "shipstatus": "shipping"
    }
  ],
  "rating": 2.5,
  "feedback": "",
  "messages": [
    {
      "message_id": "",
      "date_created": 0,
      "from": "",
      "message": ""
    }
  ]
}

Add/Update order

You need to build an http server endpoint that when asked for a request similar to this:

POST https://wwww.example.com/your/endpoint/url?jobid=123&id=75554554546
C2SKey: {{API KEY}}

{
  "_id": "75554554546",
  "orderid": "75554554546",
  "last_updated": 1517360038797,
  "status": "paid",
  "dateCreated": "",
  "dateClosed": "",
  "total": {
    "amount": 350,
    "currency": "USD"
  },
  "orderItems": [
    {
      "id": "7778545",
      "variation_id": "0",
      "quantity": 1,
      "unitPrice": 350,
      "currencyId": "USD"
    }
  ],
  "buyer": {
    "id": "4578889",
    "email": "testbuyer@example.com",
    "phone": "88888888",
    "firstName": "John",
    "lastName": "Doe",
    "billingaddress": {
      "addressline": "",
      "zipcode": "",
      "city": "",
      "state": "",
      "country": ""
    },
    "shipmentaddress": {
      "addressline": "",
      "zipcode": "",
      "city": "",
      "state": "",
      "country": ""
    }
  },
  "shipments":[
    {
      "id": "123",
      "shiptracknum": "TRK-1203912",
      "shipitems": ["4578889"],
      "shiptype": "Fedex",
      "shipstatus": "shipping"
    }
  ],
  "rating": 2.5,
  "feedback": "",
  "messages": [
    {
      "message_id": "",
      "date_created": 0,
      "from": "",
      "message": ""
    }
  ]
}

executes the "INSERT/UPDATE" operation on the external data storage, database, application, etc. and if succeeds returns the created object with the following JSON structure:

{
  "success": true,
  "code": 200,
  "warnings": [],
  "order": {
    "_id": "75554554546",
    "orderid": "75554554546",
    "last_updated": 1517360038797,
    "status": "paid",
    "dateCreated": "",
    "dateClosed": "",
    "total": {
      "amount": 350,
      "currency": "USD"
    },
    "orderItems": [
      {
        "id": "7778545",
        "variation_id": "0",
        "quantity": 1,
        "unitPrice": 350,
        "currencyId": "USD"
      }
    ],
    "buyer": {
      "id": "4578889",
      "email": "testbuyer@example.com",
      "phone": "88888888",
      "firstName": "John",
      "lastName": "Doe",
      "billingaddress": {
        "addressline": "",
        "zipcode": "",
        "city": "",
        "state": "",
        "country": ""
      },
      "shipmentaddress": {
        "addressline": "",
        "zipcode": "",
        "city": "",
        "state": "",
        "country": ""
      }
    },
    "shipments":[
      {
        "id": "123",
        "shiptracknum": "TRK-1203912",
        "shipitems": ["4578889"],
        "shiptype": "Fedex",
        "shipstatus": "shipping"
      }
    ],
    "rating": 2.5,
    "feedback": "",
    "messages": [
      {
        "message_id": "",
        "date_created": 0,
        "from": "",
        "message": ""
      }
    ]
  }
}

if fails to uspert error should return the following JSON structure:

{
  "success": false,
  "code": 400,
  "error": "Could not upsert sales order",
  "reasons":[
    {
      "msg": "Invalid blank SKU"
    },
    {
      "msg": "Invalid SKU"
    },
    {
      "msg": "Invalid 0 quantity"
    },
    {
      "msg": "Invalid business partner"
    },
    {
      "msg": "Invalid status"
    }
  ],
  "warnings": []
}
Your browser is out of date!

Update your browser to view this website correctly. Update my browser now

×