# API Normalization Feeds Integration

Integrates API Normalization with Drupal Feeds module for bulk API imports.

## Overview

API Normalization Feeds Integration is a **submodule** that bridges the API Normalization module with the Drupal Feeds module, enabling bulk imports of normalized API data.

## Features

- Bulk API data imports using Feeds module
- Normalized API response processing
- Configurable field mappings
- Support for multiple API providers
- Batch processing for large datasets

## Requirements

- Drupal 10.3+ or 11.x
- API Normalization (parent module)
- **Feeds module** (`feeds/feeds`) - Required contrib module

## Installation

```bash
# Install Feeds module first
composer require drupal/feeds

# Enable modules
drush en api_normalization feeds api_normalization_feeds
```

## Configuration

1. Navigate to **Admin > Structure > Feeds**
2. Create a new Feed Type
3. Configure API Normalization as the fetcher/parser
4. Map fields from normalized API responses to Drupal entities

## Usage

### Creating a Feed Importer

1. Go to `/admin/structure/feeds`
2. Click "Add feed type"
3. Configure:
   - **Fetcher**: API Normalization Fetcher
   - **Parser**: API Normalization Parser
   - **Processor**: Your target entity type

### Field Mapping

Map normalized API fields to your Drupal entity fields:

```yaml
# Example mapping configuration
source_field: normalized_api_field
target_field: drupal_entity_field
```

### Running Imports

```bash
# Via Drush
drush feeds:import feed_type_id

# Via UI
# Navigate to Content > Feeds > Import
```

## API Integration

This module extends Feeds with API Normalization capabilities:

```php
// Feeds will automatically use normalized API responses
$feed = Feed::create([
  'type' => 'api_normalized_feed',
  'title' => 'My API Feed',
]);
$feed->import();
```

## Use Cases

1. **Content Migration**: Bulk import content from external APIs
2. **Data Synchronization**: Regular updates from API providers
3. **Multi-source Aggregation**: Combine data from multiple APIs
4. **Automated Content Creation**: Schedule regular API imports

## Related Modules

- **api_normalization** - Parent module (required)
- **feeds** - Drupal Feeds module (required)
- **api_normalization_ui** - Enhanced UI components
- **api_normalization_graphql** - GraphQL support

## Troubleshooting

### Import Failures

Check:
1. API credentials are configured in API Normalization settings
2. Feed type is properly configured
3. Field mappings are correct
4. API endpoints are accessible

### Performance Issues

For large imports:
1. Enable batch processing in Feed type settings
2. Adjust PHP memory limits
3. Use Drush for command-line imports
4. Consider using Queue API for background processing

## Documentation

- [API Normalization Documentation](../../README.md)
- [Feeds Module Documentation](https://www.drupal.org/docs/contributed-modules/feeds)

## Support

- Issue queue: https://www.drupal.org/project/issues/api_normalization
- Feeds documentation: https://www.drupal.org/docs/contributed-modules/feeds

## License

GPL-2.0-or-later
