Skip to main content

Treatwell integration endpoints

Here there is a list of useful endpoints to check and debug Treatwell integration system.

General things to remember reading this page:

  • UALA's venue ID is mapped with TW's venue ID adding 100000000, so 237 in UALA corresponds with 100000237 in TW

Marketplace Supplier Aggregator (saas -> marketplace)​

Hosts can be:

  • mp-supplier-aggregator.dev01.k8s.dev.twcloud.io DEV01 environment
  • mp-supplier-aggregator.prod.k8s.prod.twcloud.io production environment

NOTE: these APIs requires x-request-id header (SecureRandom.uuid)

Authentication​

Bearer authentication token can be obtained for production, dev01 and staging when authenticated with TW's Google account

List venue services​

/service?venueId={venue_id}

List venue menu​

/venue/{venue_id}/menu

Translate SaaS service's ID to marketplace service's ID​

/partner/uala-saas/service/{service_id}/marketplace-id

Translate marketplace service's ID to SaaS service's ID​

/service/{service_id}/partner-id

Translate marketplace service option's ID to SaaS option's ID​

/service-option/{service_option_id}/partner-id

Force venue's availability reindex (with POST method)​

/browse-webapp/venue/{venue_id}/local-browse-index

Get Venue's availability​

/api/partner/uala-saas/venue/{venue_id}/inventory/availability/{YYYY-MM-DD}

SaaS APIs (marketplace -> saas)

The full list of APIs available can be found in https://github.com/treatwell/marketplace-integration-api

Authentication​

You can use this snippet to create a valid JWT to authenticate with SaaS apis (use partners.treatwell.net.dev01.twtest.io for dev01 or partners.treatwell.net for prod)

pem_key =
<<~EOF
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
EOF
private_key = OpenSSL::PKey.read(pem_key)
token = Uala::Jwt::Generator.new(
ecdsa_key: private_key,
issuer: 'https://partners.treatwell.net.dev01.twtest.io/api/auth/partner/mp-booking',
kid: 'mp-booking-184f584d-a317-45c4-9b29-c4202e80a294'
)
token.generate!(exp: 24.hours.from_now.to_i)

You'll need the private key to create it, ask some workspace admin to have it or to provide a token instead.