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

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": ""
		}
	  ]
	},
	{
	  "_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": ""
		}
	  ]
	}
  ]
}
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

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?offset=0&id=100004777


{
  "_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": ""
	}
  ]
}

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

{
  "_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": ""
	}
  ]
}

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:

{
  "_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": ""
	}
  ]
}
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

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"
	  }
	}
  ]
}

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

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?offset=0&id=75554554546


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

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

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

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:

{
  "_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"
  }
}
Your browser is out of date!

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

×