Skip to main content

Vendor → ONDA Request

This is an integration guide for the Push method where vendors (accommodation providers) send data to the ONDA system.

Overview

The Vendor → ONDA Request method is an integration approach where the vendor system calls the ONDA API to update data.

Features

  • Proactive Updates: Vendors immediately send changes to the ONDA system when they occur
  • Push Method: Vendors actively send data
  • Real-time Synchronization: Changes are reflected in ONDA in real-time
  • Efficiency: Can selectively send only changed data

Integration Flow

Main API Endpoints

ONDA APIs called by vendors:

1. Property Information Update

  • Endpoint: PUT /api/v1/properties/{property_id}
  • Purpose: Update basic property information, amenities, images
  • Call Timing: When property information changes
  • Request Data: Changed property information

2. Room Type Information Update

  • Endpoint: PUT /api/v1/properties/{property_id}/rooms/{room_id}
  • Purpose: Update room types, detailed information, amenities
  • Call Timing: When room information changes
  • Request Data: Changed room information

3. Rate Information Update

  • Endpoint: POST /api/v1/rates/bulk-update
  • Purpose: Update rates by room, discount information, cancellation policy
  • Call Timing: When rates change or periodically
  • Request Data: Rate information by period

4. Inventory Information Update

  • Endpoint: POST /api/v1/inventory/bulk-update
  • Purpose: Update inventory by room, reservation restriction information
  • Call Timing: When inventory changes or in real-time
  • Request Data: Inventory information by date

Authentication and Security

API Authentication

  • Method: Bearer Token authentication
  • Header: Authorization: Bearer {ACCESS_TOKEN}
  • Token Renewal: Automatic renewal required before expiration

Token Acquisition

POST /api/v1/auth/token
Content-Type: application/json

{
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"grant_type": "client_credentials"
}

Security Requirements

  • HTTPS Required: All API calls must use HTTPS
  • Token Management: Secure token storage and periodic renewal
  • Request Limits: Comply with rate limiting (1000 calls per hour)

Request Format

All API requests use JSON format:

{
"timestamp": "2024-09-26T15:30:00Z",
"data": {
// Actual update data
},
"metadata": {
"source": "vendor_system",
"version": "1.0"
}
}

Property Information Update Example

{
"timestamp": "2024-09-26T15:30:00Z",
"data": {
"property_id": "PROP001",
"name": "Hotel ONDA",
"description": "Business hotel located in central Seoul",
"amenities": ["wifi", "parking", "breakfast"],
"images": [
{
"url": "https://example.com/image1.jpg",
"type": "exterior",
"order": 1
}
]
}
}

Response Processing

Success Response

{
"status": "success",
"message": "Data updated successfully",
"data": {
"updated_at": "2024-09-26T15:30:05Z",
"affected_records": 1
}
}

Error Response

{
"status": "error",
"error_code": "VALIDATION_ERROR",
"message": "Request data validation failed",
"details": [
{
"field": "property_id",
"error": "This field is required"
}
]
}

Development Guide

Easily integrate using the SDK provided by ONDA:

// Node.js SDK example
const OndaSDK = require('@onda/vendor-sdk');

const client = new OndaSDK({
clientId: 'your_client_id',
clientSecret: 'your_client_secret',
environment: 'production' // or 'sandbox'
});

// Update property information
await client.properties.update('PROP001', {
name: 'Hotel ONDA',
description: 'Updated description'
});

2. Direct API Calls

If SDK is not available, make direct HTTP requests:

# Python example
import requests
import json

def update_property(property_id, data):
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}

response = requests.put(
f'https://api.onda.kr/v1/properties/{property_id}',
headers=headers,
data=json.dumps(data)
)

return response.json()

3. Batch Processing

Use batch API for efficient processing of large amounts of data:

{
"batch_id": "BATCH001",
"operations": [
{
"operation": "update",
"resource": "property",
"id": "PROP001",
"data": { /* update data */ }
},
{
"operation": "update",
"resource": "room",
"id": "ROOM001",
"data": { /* update data */ }
}
]
}

Error Handling

Retry Logic

Retry mechanism for network errors or temporary failures:

async function retryRequest(requestFn, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await requestFn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await sleep(Math.pow(2, i) * 1000); // Exponential backoff
}
}
}

Error Code Processing

  • 401 Unauthorized: Token reissuance required
  • 429 Too Many Requests: Request limit exceeded, wait briefly
  • 422 Unprocessable Entity: Data validation failed
  • 500 Internal Server Error: Server error, retry then contact support team

Monitoring and Logging

Log Recording

// Log example
{
"timestamp": "2024-09-26T15:30:00Z",
"level": "INFO",
"message": "Property updated successfully",
"data": {
"property_id": "PROP001",
"response_time": 245,
"status_code": 200
}
}

Metrics Tracking

  • API call success rate
  • Average response time
  • Error rate and error types
  • Data update frequency

Previous: ONDA → Vendor Request method guide