Requests¶
All dispatchable requests will use one of the following external hosts. Routing, and host definitions are defined in config.yml.
Ping¶
-
GET
/api/admin/ping
¶ Ping the API to see if the server is currently running.
Request Headers: - Content-Type – application/json
Response Headers: - Content-Type – application/json
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "Server": "Live", "DB Status": "Live" }
PHP Implementation Example:
use Expressly\Event\ResponseEvent; use Expressly\Subscriber\UtilitySubscriber; $event = new ResponseEvent(); $app['dispatcher']->dispatch(UtilitySubscriber::UTILITY_PING, $event); if ($event->isSuccessful()) { }
Register Merchant¶
-
POST
/api/v2/plugin/merchant
¶ Register a store with the server.
Request JSON Object: - apiBaseUrl (string) – see merchant_url; if there isn’t any special base routing the value should be the exact same as the shop url
- apiKey (string) – api key retrieved from the Portal (see <https://buyexpressly.com/#/install>)
Request Headers: - Content-Type – application/json
Status Codes: - 204 No Content – Registered successfully
- 400 Bad Request – Invalid data/request
PHP Implementation Example:
use Expressly\Event\MerchantEvent; use Expressly\Subscriber\MerchantSubscriber; $event = new MerchantEvent(...); $app['dispatcher']->dispatch(MerchantSubscriber::MERCHANT_REGISTER, $event); if ($event->isSuccessful()) { }
Get Campaign Migration Popup¶
-
GET
/api/v2/migration/
(string: uuid)¶ Request the popup to start a campaign migration for the unique user.
Parameters: - uuid – Unique campaign migration uuid
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – text/html
Status Codes: - 200 OK – campaign migration found, html for popup returned
- 400 Bad Request – Invalid data/request
PHP Implementation Example:
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_POPUP, $event); if ($event->isSuccessful()) { }
Get Campaign Migration Data¶
-
GET
/api/v2/migration/
(string: uuid)/user
¶ User has accepted popup, or been forced here directly; request, and start data migration.
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – Successfully returns user information
- 400 Bad Request – Invalid data/request
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "meta": { "locale": "UKR", "sender": "https://expresslyapp.com/api/v1/migration/{uuid}" }, "data": { "email": "john.smith@gmail.com", "customerData": { "firstName": "John", "lastName": "Smith", "gender": "M", "billingAddress": 0, "shippingAddress": 1, "company": "Expressly", "dob": "1987-08-07", "taxNumber": "GB0249894821", "onlinePresence": [ { "field": "website", "value": "http://www.myblog.com" } ], "dateUpdated": "2015-07-10T11:42:00+01:00", "emails": [ { "email": "john.smith@gmail.com", "alias": "default" }, { "email": "john@smithcorp.com", "alias": "work" } ], "phones": [ { "type": "M", "number": "020734581250", "countryCode": 44 }, { "type": "L", "number": "020731443250", "countryCode": 44 } ], "addresses": [ { "firstName": "John", "lastName": "Smith", "address1": "12 Piccadilly", "address2": "Room 14", "city": "London", "companyName": "WorkHard Ltd", "zip": "W1C 34U", "phone": 1, "alias": "Work address", "stateProvince": "LND", "country": "GBR" }, { "firstName": "John C.", "lastName": "Smith", "address1": "23 Sallsberry Ave", "address2": "Flat 3", "city": "London", "companyName": "", "zip": "NW3 4HG", "phone": 0, "alias": "Home address", "stateProvince": "LND", "country": "GBR" } ] }, "cart": { "productId": "491", "couponCode": "20OFF" } } }
PHP Implementation Example:
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_DATA, $event); if ($event->isSuccessful()) { }
Migration Success¶
-
POST
/api/v2/migration/
(string: uuid)/success
¶ Tells the server if the migration was successful, or if the user already existed on this store.
Parameters: - uuid – Unique campaign migration uuid
Request JSON Object: - status (enum) – enum to tell server is migration was successful; can be: ‘migrated’, ‘existing_customer’
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – Migration status acknowledged
- 400 Bad Request – Invalid data/request
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "success": "true", "msg": "" }
PHP Implementation Example:
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_SUCCESS, $event); if ($event->isSuccessful()) { }
Get Campaign Banner¶
If banner campaign is setup, get banner for a specified store, and email combination.
Parameters: - uuid – Unique banner uuid
- email – Email for the currently logged in user
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – application/json
Status Codes: - 200 OK – Successfully found valid data for campaign banner
- 400 Bad Request – Invalid data/request
Example Response:
HTTP/1.1 200 OK Content-Type: application/json { "bannerImageUrl": "https://buyexpressly.com/assets/banner/awesome-banner.jpg", "migrationLink": "https://www.myblog.com/expressly/api/3aff1880-b0f5-45bd-8f33-247f55981f2c }
PHP Implementation Example:
use Expressly\Event\BannerEvent; use Expressly\Subscriber\BannerSubscriber; $event = new BannerEvent(...); $app['dispatcher']->dispatch(BannerSubscriber::BANNER_REQUEST, $event); if ($event->isSuccessful()) { }
[config.yml] | src/Resources/config/config.yml |
[merchant_url] | the location to execute/catch our paths; example: https://www.example.com/route?action=/expressly/api/ping |
[Portal] | Expressly Portal: https://buyexpressly.com/#/portal/login |