Skip to main content

Inbound API Configuration

Configure Odoo to receive data from external systems through RESTful API endpoints.

Step-by-Step Configuration

Step 1: Access Configuration

Navigate to Settings > Technical > BJ API > API Configurations in your Odoo interface.

API Settings Menu API Configurations menu in Technical Settings

Step 2: Create New Configuration

Click the Create button to start a new API synchronization configuration.

API Configuration Form New API Configuration form

Step 3: Set Request Type

Select Request Type as "In" for inbound data synchronization.

Inbound Configuration Select "In" for inbound data synchronization

Step 4: Configure Basic Settings

General Settings

Model Settings Configure model and filter settings

  • Name: Enter a descriptive name (e.g., "Partner Import API")
  • Model: Select the target Odoo model (e.g., res.partner, product.product)
  • Filter Domain: Add conditions to filter records (optional)

Filter Domain Configuration Set up domain filters for record selection

[('active', '=', True)]

Endpoint Configuration

Endpoint Configuration Configure the API endpoint identifier

  • Endpoint: Define a unique identifier for your endpoint (e.g., "partners")
  • This creates the API path: /bj_api_sync/v1/partners

HTTP Methods

HTTP Methods Configuration Select allowed HTTP operations

Select the allowed operations:

  • GET: Retrieve records
  • POST: Create new records
  • PUT: Update existing records
  • DELETE: Remove records

Step 5: Configure Authentication

Choose your authentication method:

No Authentication

Suitable for internal or public APIs with no security requirements.

Basic Authentication

Requires username and password:

Basic Authentication Basic Authentication configuration

  • Login: API username
  • Password: API password

Bearer Token

Uses API key authentication:

Bearer Token Authentication Bearer Token configuration

  • Bearer Token: Your API key or access token

Example header:

Authorization: Bearer your_token_here

Step 6: Set Up Field Mappings

Create Configuration Lines to map Odoo fields to API keys:

Field Mapping Configuration Configure field mappings between Odoo and external API

Odoo FieldExternal API KeyRecord IdentifierValue Type
namenamePlain
emailemail_addressPlain
refcustomer_idPlain
phonecontact_phonePlain

Configuration Lines Detail Detailed view of configuration lines with all options

Important: Exactly one field must be marked as the Record Identifier.

Step 7: Configure Pagination (Optional)

For large datasets:

Pagination Settings Pagination configuration for large datasets

  • Is Paginated: Enable pagination
  • Page Size: Records per request (default: 100)

API Endpoint Patterns

Once configured, your endpoint will be available at:

Base Pattern:
/bj_api_sync/v1/<endpoint_name>
/bj_api_sync/v1/<endpoint_name>/<record_id>

Example Requests

GET Request - Retrieve All Records

curl -X GET "http://localhost:8069/bj_api_sync/v1/partners" \
-H "Authorization: Bearer your_token_here"

GET Request - Retrieve Single Record

curl -X GET "http://localhost:8069/bj_api_sync/v1/partners/123" \
-H "Authorization: Bearer your_token_here"

POST Request - Create New Record

curl -X POST "http://localhost:8069/bj_api_sync/v1/partners" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_token_here" \
-d '{
"name": "Test Partner",
"email": "test@example.com",
"phone": "+1234567890"
}'

PUT Request - Update Record

curl -X PUT "http://localhost:8069/bj_api_sync/v1/partners/123" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_token_here" \
-d '{
"name": "Updated Partner Name",
"email": "updated@example.com"
}'

DELETE Request - Remove Record

curl -X DELETE "http://localhost:8069/bj_api_sync/v1/partners/123" \
-H "Authorization: Bearer your_token_here"

Processing Pipeline

The inbound request follows this flow:

HTTP Request → Authentication → Method Check → Configuration Lookup 
→ Data Transformation → Record Processing → Response Generation → Logging

Response Formats

Success Response

{
"status": "success",
"data": {
"id": 123,
"name": "Test Partner",
"email": "test@example.com"
}
}

Error Response

{
"status": "error",
"message": "Authentication failed",
"code": 401
}

Common Error Codes

CodeDescriptionSolution
401UnauthorizedCheck authentication credentials
404Not FoundVerify endpoint configuration
405Method Not AllowedEnable the HTTP method in configuration
400Bad RequestValidate JSON data format
500Internal Server ErrorCheck server logs for details

Best Practices

  1. Use HTTPS in production environments
  2. Implement rate limiting to prevent abuse
  3. Validate input data using Python scripts
  4. Log all requests for audit trail
  5. Test thoroughly before production deployment

Next Steps