# Set Up Guide ## Introduction This guide will help you configure your environment for integrating with the **Check In Service API**. This API facilitates the transfer of check-in and check-out information to CLC while providing robust security and reliability. Follow these steps to set up your development and production environments effectively. ## Prerequisites Before you begin, ensure you have: - **API Key**: Obtain your `X-Api-Key` from the administrator. - **Base URLs**: - **Mock Server URL**: `https://c3a1ba49-c2e4-4e2f-829e-1195823e9d09.mock.pstmn.io` - **Production URL**: (provided during production setup) - An HTTP client or tool like Postman, cURL, or a supported SDK in your programming language. - Basic understanding of RESTful APIs, JSON, and authentication headers. ## Step 1: Configure Your Development Environment 1. **Set Up Access to the Mock Server** - Use the following URL for testing and simulating API requests: ``` https://c3a1ba49-c2e4-4e2f-829e-1195823e9d09.mock.pstmn.io ``` 2. **Store Your API Key Securely** - Your `X-Api-Key` must be included in all requests. - Example for cURL: ```bash curl -X POST https://c3a1ba49-c2e4-4e2f-829e-1195823e9d09.mock.pstmn.io/api/v1/card/authorize \ -H "X-Api-Key: your-api-key-here" \ -H "Content-Type: application/json" \ -d '{"membershipId": "123456789"}' ``` 3. **Install Required Tools** - Install a library for HTTP requests (e.g., `requests` for Python or `axios` for Node.js). 4. **Test Your Connection** - Verify connectivity by calling the `GET /api/v1/reservation/status/{requestId}` endpoint with a valid `requestId`: ```bash curl -X GET https://c3a1ba49-c2e4-4e2f-829e-1195823e9d09.mock.pstmn.io/api/v1/reservation/status/bb8350fc-dce1-41a1-91b1-91b0d64b5eeb \ -H "X-Api-Key: your-api-key-here" ``` - Expected response: ```json { "authId": 177317191, "authStatus": "checked_in", "employeeIdentifier": "123456789" } ``` ## Step 2: Set Up Your Production Environment 1. **Switch to Production URL** - Update the base URL to the production environment provided by the administrator. ``` https://api.yourcompany.com ``` 2. **Use Separate API Keys** - Use a distinct production `X-Api-Key` to ensure secure access. 3. **Test Production Access** - Start by verifying the status endpoint in production: ```bash curl -X GET https://api.yourcompany.com/api/v1/reservation/status/{requestId} \ -H "X-Api-Key: your-production-api-key" ``` - Ensure the response matches expectations before deploying live requests. ## Step 3: Handle Tokenised Linking Between Requests 1. **Card Authorisation (`/api/v1/card/authorize`)** - Authorise the customer’s membership card and retrieve an `authId`: ```json { "authId": 177317191, "authStatus": "authorized", "employeeIdentifier": "123456789" } ``` 2. **Check-In (`/api/v1/reservation/checkin`)** - Use the `authId` from the authorisation step to check in a guest: ```json { "authId": 177317191, "authStatus": "checked_in", "employeeIdentifier": "1234345", "supplierReservationId": "1234", "checkInDateTime": "2024-10-17T14:30:00-05:00", "roomNumber": "204", "folioNumber": "204", "guestFirstName": "Ada", "guestLastName": "Lovelace" } ``` 3. **Check-Out (`/api/v1/reservation/checkout`)** - Use the same `authId` to check out the guest and provide stay details: ```json { "authId": 177317191, "authStatus": "checked_out", "employeeIdentifier": "1234345", "supplierReservationId": "1234", "checkOutDateTime": "2025-10-17T14:30:00-05:00", "roomNumber": "204", "folioNumber": "204", "guestFullName": "Ada Lovelace", "checkInDateTime": "2024-10-17T14:30:00-05:00" } ``` ## Best Practices - **Use Environment Variables**: Store URLs and API keys securely as environment variables. - **Log All Requests and Responses**: Maintain a clear audit trail. - **Validate All Inputs**: Ensure payloads conform to the schema specified in the [API Reference](#). ## Troubleshooting - **400 Bad Request**: Verify your payload against the schema. - **404 Not Found**: Ensure your `requestId` or `authId` exists. - **500 Internal Server Error**: Contact support if this persists. For detailed endpoint information, visit the [API Reference](#).