Requests¶
All dispatchable requests will use one of the following external hosts. Routing, and host definitions are defined in config.yml.
external:
hosts:
default: http://prod.expresslyapp.com/api/v1
admin: http://prod.expresslyapp.com/api/admin
Ping¶
-
GET
/api/admin/ping
¶ Ping the API to see if the server is currently running.
use Expressly\Event\ResponseEvent; use Expressly\Subscriber\UtilitySubscriber; $event = new ResponseEvent(); $app['dispatcher']->dispatch(UtilitySubscriber::UTILITY_PING, $event); if ($event->isSuccessful()) { }
Request Headers: - Content-Type – application/json
Response Headers: - Content-Type – application/json
Response JSON Object: - Server (string) – If server is running, or not.
- DB Status (string) – Status of the current state of the database.
Register Merchant¶
-
POST
/api/v1/register
¶ Register a store with the server.
use Expressly\Event\MerchantEvent; use Expressly\Subscriber\MerchantSubscriber; $event = new MerchantEvent(...); $app['dispatcher']->dispatch(MerchantSubscriber::MERCHANT_REGISTER, $event); if ($event->isSuccessful()) { }
Request JSON Object: - shopName (string) – shop name
- shopUrl (string) – shop url (https://www.example.com)
- apiBaseUrl (string) – see merchant_url; if there isn’t any special base routing the value should be the exact same as the shop url
- shopImageUrl (string) – logo url
- termsAndConditionsUrl (string) – url to terms, and conditions page
- policyUrl (string) – url to privacy policy page
- pluginVersion (string) – plugin version (current: v1)
Request Headers: - Content-Type – application/json
Response Headers: - Content-Type – application/json
Response JSON Object: - merchantUuid (string) – the unique identifier for your installation
- secretKey (string) – the token associated with your installation
Status Codes:
Update Merchant¶
-
POST
/api/v1/merchant/
(string: uuid)/update
¶ Update details for an existing store.
use Expressly\Event\PasswordedEvent; use Expressly\Subscriber\MerchantSubscriber; $event = new PasswordedEvent(...); $app['dispatcher']->dispatch(MerchantSubscriber::MERCHANT_UPDATE, $event); if ($event->isSuccessful()) { }
Parameters: - uuid – Unique merchant uuid
Request JSON Object: - shopName (string) – shop name
- shopUrl (string) – shop url (https://www.example.com)
- apiBaseUrl (string) – see merchant_url; if there isn’t any special base routing the value should be the exact same as the shop url
- shopImageUrl (string) – logo url
- termsAndConditionsUrl (string) – url to terms, and conditions page
- policyUrl (string) – url to privacy policy page
- pluginVersion (string) – plugin version (current: v1)
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – application/json
Response JSON Object: - merchantUuid (string) – unique identifier for your installation
- shopName (string) – shop name
- shopUrl (string) – shop url (https://www.example.com)
- apiBaseUrl (string) – see merchant_url; if there isn’t any special base routing the value should be the exact same as the shop url
- shopImageUrl (string) – logo url
- termsAndConditionsUrl (string) – url to terms, and conditions page
- policyUrl (string) – url to privacy policy page
- pluginVersion (string) – plugin version (current: v1)
- lastPingTime (string) – ISO 8601 timestamp of last time the server tried to ping the store
- lastSuccessPingTime (string) – ISO 8601 timestamp of last time the server pinged the store successfully
- lastPingSuccessful (boolean) – If the above (lastPingTime) was successful, or not
Status Codes:
Remove Merchant¶
-
POST
/api/v1/merchant/
(string: uuid)/uninstall
¶ Remove store from the expressly system.
use Expressly\Event\PasswordedEvent; use Expressly\Subscriber\MerchantSubscriber; $event = new PasswordedEvent(...); $app['dispatcher']->dispatch(MerchantSubscriber::MERCHANT_DELETE, $event); if ($event->isSuccessful()) { }
Parameters: - uuid – Unique merchant uuid
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response JSON Object: - success (boolean) –
- msg (string) – Associated message
Status Codes:
Get Campaign Migration Popup¶
-
GET
/api/v1/migration/
(string: uuid)¶ Request the popup to start a campaign migration for the unique user.
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_POPUP, $event); if ($event->isSuccessful()) { }
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 –
Get Campaign Migration Data¶
-
GET
/api/v1/migration/
(string: uuid)/user
¶ User has accepted popup, or been forced here directly; request, and start data migration.
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_DATA, $event); if ($event->isSuccessful()) { }
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, "addressAlias": "Work address", "stateProvinceID": "LND", "countryID": "GBR" }, { "firstName": "John C.", "lastName": "Smith", "address1": "23 Sallsberry Ave", "address2": "Flat 3", "city": "London", "companyName": "", "zip": "NW3 4HG", "phone": 0, "alias": "Home address", "stateProvinceID": "LND", "countryID": "GBR" } ] } } }
Parameters: - uuid – Unique campaign migration uuid
Request Headers: - Content-Type – application/json
- Authorization – Basic token
Response Headers: - Content-Type – application/json
Status Codes:
Migration Success¶
-
POST
/api/v1/migration/
(string: uuid)/success
¶ Tells the server if the migration was successful, or if the user already existed on this store.
use Expressly\Event\CustomerMigrateEvent; use Expressly\Subscriber\CustomerMigrationSubscriber; $event = new CustomerMigrateEvent(...); $app['dispatcher']->dispatch(CustomerMigrationSubscriber::CUSTOMER_MIGRATE_SUCCESS, $event); if ($event->isSuccessful()) { }
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
Response JSON Object: - success (boolean) –
- msg (string) – Associated message
Status Codes:
Get Campaign Banner¶
If banner campaign is setup, get banner for a specified store, and email combination.
use Expressly\Event\BannerEvent; use Expressly\Subscriber\BannerSubscriber; $event = new BannerEvent(...); $app['dispatcher']->dispatch(BannerSubscriber::BANNER_REQUEST, $event); if ($event->isSuccessful()) { }
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
Response JSON Object: - bannerImageUrl (string) – url of the image; set in the Portal
- migrationLink (string) – url to populate the banner
Status Codes:
[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 |