php-cupid/cupid

PHP SDK for cupid mapping

dev-master 2022-04-19 11:13 UTC

This package is not auto-updated.

Last update: 2025-08-08 02:03:50 UTC


README

License: MIT

php-cupid/cupid

Table of Contents

Description

Performing mapping through the Cupid API is very straightforward. You'll first upload your properties inventory to be used as reference and then send a list of properties to be mapped to the API and get the results directly in the response.

Installation

Requires PHP version >=5.3.
The recommended way to install Guzzle is through Composer.

composer require php-cupid/cupid

Method

NOTE: The documentation below is up-to-date with 3.x releases, if you are using an older version, please check how to upgrade.

uploadInventory

This function can be used to upload an inventory with a provided CSV file.

You will have to provide the inventory's name and for each column in your file, you'll need match its index with the standard field names provided below.

Let's assume you have a CSV file that looks like the following table:

HotelIDHotel_NameHotel_AddressHotel_LatHotel_LonCountryCity...
1408Smile Hotel123 main st5.4195143.392694AUAdelaid...
123Cupid resort456 north av55.6925437.3167887MAZagoura...

In this case the form data would be:

  • file: The csv file to be uploaded
  • name: Cupid inventory
  • header_id: 0
  • header_name: 1
  • header_address: 2
  • header_city: 6
  • header_country_code: 5
  • header_latitude: 3
  • header_longitude: 4
require  "vendor/autoload.php";
$cupid = new App\Cupid(*YOUR  API  KEY*);
$uploadInventory = $cupid->uploadInventory("my npm catalog", "./file.csv", 0, 1, 2, 3, 4, 5, 6)
var_dump($uploadInventory);

listInventories

This function can be used to list the inventories uploaded to your workspace.
You can check their status and other basic info.

require  "vendor/autoload.php";
$cupid = new App\Cupid(*YOUR  API  KEY*);
$listInventories = $cupid->listInventories()
var_dump($uploadInventory);

inventoryDetails

This function can be used to check the requested inventory's details.

You can use it to get the inventory status mapping_process_status_id as outlined below. The status has to be 2 (Done) to start mapping.

Possible values for the inventory's status mapping_process_status_id:

valueNameDescriptionAction
-1InvalidThe inventory doesn't contain any valid hotelsCorrect your catalog and try again.
0PendingThe inventory is being uploadedWait, no action required.
1ProcessingThe inventory is being processedWait, no action required.
2DoneThe process is completeYou can start mapping.
3FailedThere was an error while processingRetry and if the error persists, feel free to contact us.

When you have an inventory with active=true and mapping_process_status_id=2 you can use the following endpoint to perfom mapping:

require  "vendor/autoload.php";
$cupid = new App\Cupid(*YOUR  API  KEY*);
$inventoryDetails = $cupid->inventoryDetails($inventory_id)
var_dump($inventoryDetails);

mapHotelList

This function allows you to send a list of properties and maps it against your active inventory. You will get the resulting mappings in the response.

Limit You can send up to 1000 properties per request.

$cupid = new App\Cupid(*YOUR  API  KEY*);
$array = [
	[
		"address" => "123 main street",
		"country_code"=> "US",
		"hotel_code"=> "1256",
		"latitude"=> 36.18743350322336,
		"longitude"=> -115.15064193665704,
		"name"=> "hotel name"
	]
];

$mapHotels = $cupid->mapHotels($array);
print_r($mapHotels);

Contact