Training Day

HTTP

HTTP (Hypertext Transfer Protocol) is the foundation of data communication on the web and serves as a reliable transport mechanism for data integrations between systems.

What is HTTP?

HTTP is a protocol that allows the fetching and transmission of resources such as HTML documents, JSON data, XML files, images, videos, or any other type of file. It operates on a client-server model where:

  • Client: Makes requests for resources (e.g., FileMaker, web browsers, mobile apps)
  • Server: Processes requests and returns appropriate responses (e.g., web servers, APIs)

Key Characteristics

  • Stateless: Each request is independent and contains all the information needed to complete it
  • Text-based: Uses human-readable headers and commands
  • Extensible: Supports various content types, authentication methods, and caching strategies
  • Application-layer: Built on top of lower-level protocols like TCP/IP

HTTP Methods

HTTP defines several methods (or verbs) that indicate the desired action:

  • GET: Retrieve data from a server
  • POST: Submit data to a server (create)
  • PUT: Update existing resources
  • DELETE: Remove resources
  • PATCH: Apply partial modifications
  • HEAD: Similar to GET but retrieves only headers (no body)
  • OPTIONS: Describes communication options for a resource

HTTP in Data Integration

HTTP serves as an excellent transport mechanism for data integration because:

  1. Universal support: Works across virtually all platforms and languages
  2. Firewall-friendly: Uses standard ports (80/443) that are typically open in firewalls
  3. Security options: HTTPS provides encryption through TLS/SSL
  4. Standardized error handling: HTTP status codes provide clear feedback
  5. Scalability: Supports load balancing and caching

FileMaker and HTTP

FileMaker provides several ways to use HTTP for data integration:

Insert From URL

The simplest method for making HTTP requests is the Insert From URL script step:

Insert From URL [Select ; $result ; "https://api.example.com/data" ; cURL options: "-X GET"]

cURL Options

FileMaker uses cURL syntax to configure HTTP requests:

  • -X METHOD: Specify HTTP method (GET, POST, etc.)
  • -H "Header: Value": Add HTTP headers
  • --data "key=value": Add request body (for POST/PUT)
  • --data-binary @filepath: Send file contents
  • --user username:password: Basic authentication

Data API

FileMaker Server provides its own HTTP-based API for accessing FileMaker data:

  • RESTful interface for CRUD operations
  • JSON data format
  • OAuth-based authentication

Status Codes

HTTP responses include status codes that indicate success or failure:

  • 2xx: Success (200 OK, 201 Created, 204 No Content)
  • 3xx: Redirection (301 Moved Permanently, 302 Found)
  • 4xx: Client errors (400 Bad Request, 401 Unauthorized, 404 Not Found)
  • 5xx: Server errors (500 Internal Server Error, 503 Service Unavailable)

Understanding these codes is crucial for robust error handling in integrations.

Best Practices

When using HTTP for data integration:

  1. Use HTTPS: Always secure data in transit
  2. Implement proper error handling: Check status codes and response formats
  3. Set appropriate timeouts: Prevent hung scripts due to slow responses
  4. Consider rate limiting: Respect API usage limits
  5. Validate input/output: Always validate data before sending/after receiving
  6. Use appropriate HTTP methods: Follow RESTful principles when possible

On this page