Skip to content

Commit

Permalink
Update documentation formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kris Lemberg committed Apr 4, 2015
1 parent d792eac commit 3b5cbfe
Show file tree
Hide file tree
Showing 18 changed files with 214 additions and 190 deletions.
13 changes: 7 additions & 6 deletions docs/guide/sdk_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Using the PHP-SDK with your extended Checkfront class, you would connect to the
:linenos:
:emphasize-lines: 6,7
new CheckfrontAPI(
$Checkfront = new CheckfrontAPI(
array(
'host' => 'your-company.checkfront.com',
'account_id' => 'off', // act on behalf of the customer
Expand Down Expand Up @@ -47,7 +47,7 @@ As with token authentication, a few fields are passed into the object on creatio
:linenos:
:emphasize-lines: 5-7
new CheckfrontAPI(
$Checkfront = new CheckfrontAPI(
array(
'host' => 'your-company.checkfront.com',
'auth_type' => 'oauth2',
Expand Down Expand Up @@ -97,7 +97,7 @@ New logins

.. sourcecode:: php

CheckfrontAPI->fetch_token($_GET['code']);
$Checkfront->fetch_token($_GET['code']);

#. On completion, a new authenticated token will be returned, and as above, the token will be sent to your **store()** function.
#. You're ready to make calls to the API on behalf of the staff member.
Expand All @@ -123,7 +123,8 @@ You could instead use:
:linenos:
$data = array(
'start_date'=>'today',
'status_id'=>'PAID'
'start_date' => 'today',
'status_id' => 'PAID'
);
Checkfront->get('booking/index',$data);
$Checkfront->get('booking/index', $data);
14 changes: 8 additions & 6 deletions docs/overview/auth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ Authenticating with Token Pairs
-------------------------------
If you are using token authentication, your application will provide you with two keys:

+------------------+
| **API Key** |
+------------------+
| **API Secret** |
+------------------+
+------------------+--------------------------------------------------------------------------------+
| **API Key** | Will be set as your *HTTP BASIC* **Username** |
+------------------+--------------------------------------------------------------------------------+
| **API Secret** | Will be set as your *HTTP BASIC* **Password** |
+------------------+--------------------------------------------------------------------------------+

When sent together in a request header using HTTP Basic authorization, these allow direct access to API endpoints without any additional preamble.

See ``CURLOPT_USERPWD`` if working with cURL libraries, or the documentation on *HTTP Basic authentication* relevant to your chosen framework. If building your requests manually, HTTP Basic credentials are **base64 encoded** in the sequence "``username:password``" and sent in the **request header** in the following format::
See ``CURLOPT_USERPWD`` if working with cURL libraries, or the documentation on *HTTP Basic authentication* relevant to your chosen framework. If building your requests manually, HTTP Basic credentials are **base64 encoded** in the sequence "``username:password``" and sent in the **request header** in the following format:

.. sourcecode:: http

Authorization: Basic M2JlOTg2NDFmMDc0NWI2ZmU3ZGFjYzJkZjk0N2FkYmMxZGE3MzEyZDo0YzRkNTk4YTVkOTQwZjA4ZmRiNDM1YjY5YWY5ODZjNzBmMjIwNmRk

Expand Down
26 changes: 17 additions & 9 deletions docs/overview/requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,20 @@ The headers of your request should also include the IP of the client you're forw

For example, to query a list of bookings with a status of PAID starting today, your full raw request might look like the following:

.. sourcecode:: http
:emphasize-lines: 1

GET /api/3.0/booking/index?start_date=today&status_id=PAID HTTP/1.1
Host: your-company.checkfront.com
Accept: application/json
X-Forwarded-For: 66.228.55.142
X-On-Behalf: 1
Authorization: Basic M2JlOTg2NDFmMDc0NWI2ZmU3ZGFjYzJkZjk0N2FkYmMxZGE3MzEyZDo0YzRkNTk4YTVkOTQwZjA4ZmRiNDM1YjY5YWY5ODZjNzBmMjIwNmRk
.. http:get:: /api/3.0/*
**Example request**:

.. sourcecode:: http
:emphasize-lines: 1

GET /api/3.0/booking/index?start_date=today&status_id=PAID HTTP/1.1
Host: your-company.checkfront.com
Accept: application/json
X-Forwarded-For: 66.228.55.142
X-On-Behalf: 1
Authorization: Basic M2JlOTg2NDFmMDc0NWI2ZmU3ZGFjYzJkZjk0N2FkYmMxZGE3MzEyZDo0YzRkNTk4YTVkOTQwZjA4ZmRiNDM1YjY5YWY5ODZjNzBmMjIwNmRk

:reqheader Authorization: Credentials used to query the API. See :ref:`auth-token` or :ref:`oauth2-ref`.
:reqheader X-On-Behalf: The staff account to act on behalf of. Use "off" to act as a customer.
:reqheader X-Forwarded-For: The IP address of the connecting client/customer.
8 changes: 4 additions & 4 deletions docs/ref/account.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
account
=======

.. http:method:: GET /api/3.0/account
.. http:get:: /api/3.0/account
.. http:response:: Retrieve a list detailing all staff accounts in your system.
Retrieve a list detailing all staff accounts in your system.

.. literalinclude:: ../examples/response/account.json
:language: js
:language: json
:linenos:
:emphasize-lines: 21-35
:emphasize-lines: 21-35
50 changes: 24 additions & 26 deletions docs/ref/booking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,34 @@ A **booking** in the system represents an order and all associated information.

booking
-------
.. http:method:: GET /api/3.0/booking
.. http:get:: /api/3.0/booking
:optparam string status_id: The current status of a booking.
:optparam integer customer_id: The customer id associated with the booking.
:optparam string customer_email: The customer email associated with the booking.
:optparam string/timestamp start_date: The date the booking starts on (i.e. check-in).
:optparam string/timestamp end_date: The date the booking starts on (i.e. check-in).
:optparam integer limit: The limit of bookings to return per page (default: 100).
:optparam integer page: The page of results to return.
Retrieve a listing of bookings in the system.

.. http:response:: Retrieves the booking index.
:query string status_id: The current status of a booking.
:query integer customer_id: The customer id associated with the booking.
:query string customer_email: The customer email associated with the booking.
:query string/timestamp start_date: The date the booking starts on (i.e. check-in).
:query string/timestamp end_date: The date the booking starts on (i.e. check-in).
:query integer limit: The limit of bookings to return per page (default: 100).
:query integer page: The page of results to return.

:>jsonarr integer booking_id: The internal index of a booking.
:>jsonarr string code: The unique booking reference code.
:>jsonarr string status_id: The status code of the booking.
:>jsonarr string status_name: The display name of the booking status.
:>jsonarr timestamp created_date: The date/time the booking was created.
:>jsonarr float total: The full value of the booking.
:>jsonarr float tax_total: The sum of the taxes applied to the booking.
:>jsonarr float paid_total: The amount the customer has paid on the booking.
:>jsonarr string customer_name: The full name of the booking contact.
:>jsonarr string customer_email: The email address of the booking contact.
:>jsonarr string summary: A brief description of the contents of the booking.
:>jsonarr string date_desc: A string describing the booked dates/times.
:>jsonarr string token: A customer token for the booking, can be used to build links to customer portions of the reservation system.

Details returned on *individual* bookings in the response:

:data integer booking_id: The internal index of a booking.
:data string code: The unique booking reference code.
:data string status_id: The status code of the booking.
:data string status_name: The display name of the booking status.
:data timestamp created_date: The date/time the booking was created.
:data float total: The full value of the booking.
:data float tax_total: The sum of the taxes applied to the booking.
:data float paid_total: The amount the customer has paid on the booking.
:data string customer_name: The full name of the booking contact.
:data string customer_email: The email address of the booking contact.
:data string summary: A brief description of the contents of the booking.
:data string date_desc: A string describing the booked dates/times.
:data string token: A customer token for the booking, can be used to build links to customer portions of the reservation system.

.. literalinclude:: ../examples/response/booking-index.json
:language: js
:language: json
:linenos:
:lines: 23-39

Expand Down
39 changes: 19 additions & 20 deletions docs/ref/booking/booking.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
booking/[booking_id]
====================
.. http:method:: GET /api/3.0/booking/{booking_id}
.. http:get:: /api/3.0/booking/{booking_id}
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string booking_id: The unique booking code identifying a booking in the system.

.. http:response:: Retrieve extended information on a specific booking.
booking/[booking_id]/invoice
----------------------------
.. http:method:: GET /api/3.0/booking/{booking_id}/invoice
.. http:get:: /api/3.0/booking/{booking_id}/invoice
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string booking_id: The unique booking code identifying a booking in the system.

.. http:response:: Return a pre-formatted invoice to display to the customer.
booking/[booking_id]/checkin
----------------------------
You can check-in and check-out a booking. By default, a note is created under the name of the account when a booking is either checked in or checked out. VOID, and CANCELLED bookings cannot be checked-in or out.

.. http:method:: POST /api/3.0/booking/{booking_id}/checkin
.. http:post:: /api/3.0/booking/{booking_id}/checkin
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string booking_id: The unique booking code identifying a booking in the system.

booking/[booking_id]/checkout
-----------------------------

.. http:method:: POST /api/3.0/booking/{booking_id}/checkout
.. http:post:: /api/3.0/booking/{booking_id}/checkout
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string booking_id: The unique booking code identifying a booking in the system.


booking/[booking_id]/update
Expand All @@ -37,34 +37,33 @@ The state of an existing booking can be modified using calls to booking/update.

Specifying the ``status_id`` is **required**, but any other update fields are optional.

.. http:method:: POST /api/3.0/booking/{booking_id}/update
.. http:post:: /api/3.0/booking/{booking_id}/update
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string status_id: The status that this booking should be set to. See **Manage / Layout / Statuses** in your account for a list of all available statuses. The default available statuses are: **PEND, HOLD, PART, PAID, WAIT, STOP,** and **VOID**
:param string booking_id: The unique booking code identifying a booking in the system.
:query string status_id: The status that this booking should be set to. See **Manage / Layout / Statuses** in your account for a list of all available statuses. The default available statuses are: **PEND, HOLD, PART, PAID, WAIT, STOP,** and **VOID**

:optparam boolean notify: Toggle whether to trigger notifications when this booking is changed. (default: 1)
:optparam boolean set_paid: When set to **1** (true) on an *unpaid* booking, and the requested status_id is '**PAID**', attempt to create a POS transaction covering the remaining cost of the booking (cannot be used with other input).
:query boolean notify: Toggle whether to trigger notifications when this booking is changed. (default: 1)
:query boolean set_paid: When set to **1** (true) on an *unpaid* booking, and the requested status_id is '**PAID**', attempt to create a POS transaction covering the remaining cost of the booking (cannot be used with other input).

.. literalinclude:: ../examples/response/booking-index.json
:language: js
:language: json
:linenos:

booking/[booking_id]/bookmark
-----------------------------

Bookmarks are made available in the Checkfront mobile apps, and are listed under bookings while logged into the platform. You can add or remove a bookmark to a specific booking for the account you are acting on behalf of.

.. http:method:: POST /api/3.0/booking/{booking_id}/bookmark
.. http:post:: /api/3.0/booking/{booking_id}/bookmark
:arg string booking_id: The unique booking code identifying a booking in the system.
:param boolean mark: Enable or disable the bookmark.
:param string booking_id: The unique booking code identifying a booking in the system.
:query boolean mark: Enable or disable the bookmark.

booking/[booking_id]/note
-------------------------
Notes can be added to bookings for reference. These will be logged in the booking as being made by the account you are acting on behalf of, so can identify comments made by individual staff members.

.. http:method:: POST /api/3.0/booking/{booking_id}/note
.. http:post:: /api/3.0/booking/{booking_id}/note
:arg string booking_id: The unique booking code identifying a booking in the system.
:param string body: The text to include in your booking note. Up to 3000 chars.

:query string body: The text to include in your booking note. Up to 3000 chars.
10 changes: 5 additions & 5 deletions docs/ref/booking/create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ booking/create
--------------
A call to booking/create must pass in a **session_id** for a :doc:`session` containing at least one :ref:`slip` in addition to customer input entered to fields from :doc:`form`

.. http:method:: POST /api/3.0/booking/create
.. http:post:: /api/3.0/booking/create
:param array form: An array of fields containing customr details matching the required and optional booking fields.
:param string session_id: The session ID containing the booking items to be committed. *Can also be sent as a cookie.*

.. http:response:: Returns the creation status and details of the booking.
Attempt to create a booking from an existing session, with customer form input sent in the request in the "form" parameter.

:form form: An array of fields containing customer details matching the required and optional booking fields (e.g. ``form[customer_name]``)
:form session_id: The session ID containing the booking items to be committed. *Can also be sent as a cookie.*
10 changes: 6 additions & 4 deletions docs/ref/booking/form.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ This call can easily be cached if your configuration does not often change, but

You will receive an error indicating missing information if you attempt to call :doc:`create` without the required fields, either those required by staff if you're acting on behalf of a staff member, or by a customer otherwise.

.. http:method:: GET /api/3.0/booking/form
.. http:get:: /api/3.0/booking/form
.. http:response:: Retrieve the customer details input form for the booking. Some fields may be required to call booking/create.
Retrieve the customer details input form for the booking. Some fields may be required to call booking/create.

:>json booking_form_ui: An array of form field definitions

.. literalinclude:: ../../examples/response/booking-form.json
:language: js
:linenos:
:language: json
:linenos:
50 changes: 24 additions & 26 deletions docs/ref/booking/index.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
booking/index
-------------
.. http:method:: GET /api/3.0/booking/index
.. http:get:: /api/3.0/booking/index
:optparam string status_id: The current status of a booking.
:optparam integer customer_id: The customer id associated with the booking.
:optparam string customer_email: The customer email associated with the booking.
:optparam string/timestamp start_date: The date the booking starts on (i.e. check-in).
:optparam string/timestamp end_date: The date the booking starts on (i.e. check-in).
:optparam integer limit: The limit of bookings to return per page (default: 100).
:optparam integer page: The page of results to return.
Retrieve a listing of bookings in the system.

.. http:response:: Retrieve a listing of bookings in the system.
Details returned on *individual* bookings in the response:
:query string status_id: The current status of a booking.
:query integer customer_id: The customer id associated with the booking.
:query string customer_email: The customer email associated with the booking.
:query string/timestamp start_date: The date the booking starts on (i.e. check-in).
:query string/timestamp end_date: The date the booking starts on (i.e. check-in).
:query integer limit: The limit of bookings to return per page (default: 100).
:query integer page: The page of results to return.

:data integer booking_id: The internal index of a booking.
:data string code: The unique booking reference code.
:data string status_id: The status code of the booking.
:data string status_name: The display name of the booking status.
:data timestamp created_date: The date/time the booking was created.
:data float total: The full value of the booking.
:data float tax_total: The sum of the taxes applied to the booking.
:data float paid_total: The amount the customer has paid on the booking.
:data string customer_name: The full name of the booking contact.
:data string customer_email: The email address of the booking contact.
:data string summary: A brief description of the contents of the booking.
:data string date_desc: A string describing the booked dates/times.
:data string token: A customer token for the booking, can be used to build links to customer portions of the reservation system.
:>jsonarr integer booking_id: The internal index of a booking.
:>jsonarr string code: The unique booking reference code.
:>jsonarr string status_id: The status code of the booking.
:>jsonarr string status_name: The display name of the booking status.
:>jsonarr timestamp created_date: The date/time the booking was created.
:>jsonarr float total: The full value of the booking.
:>jsonarr float tax_total: The sum of the taxes applied to the booking.
:>jsonarr float paid_total: The amount the customer has paid on the booking.
:>jsonarr string customer_name: The full name of the booking contact.
:>jsonarr string customer_email: The email address of the booking contact.
:>jsonarr string summary: A brief description of the contents of the booking.
:>jsonarr string date_desc: A string describing the booked dates/times.
:>jsonarr string token: A customer token for the booking, can be used to build links to customer portions of the reservation system.

.. literalinclude:: ../../examples/response/booking-index.json
:language: js
:language: json
:linenos:
:emphasize-lines: 23-39
:emphasize-lines: 23-39

0 comments on commit 3b5cbfe

Please sign in to comment.