When an integration between two systems is tested for the first time, it is natural to look at the HTTP status returned by the call. If the response is 200 OK, the temptation is to conclude that the connection works and that the job is essentially finished.
That conclusion comes too quickly. An HTTP 200 status indicates that the server received the request and returned a response that was valid at the HTTP protocol level. It does not, by itself, prove that authentication was handled correctly in every situation, that the script completed the intended work, that the record was created only once, or that the system knows what to do when the network interrupts the exchange. It proves that a request received a response. A reliable integration must guarantee much more.

The first mistake: confusing transport with outcome
The FileMaker Data API returns JSON responses containing messages and, where applicable, response data. The HTTP layer and the application layer are connected, but they are not the same thing. A request can reach the server and produce a valid HTTP response while the operational result is not the one expected by the business process.
This matters especially when the call runs a FileMaker script. The script may have started, but it may also have encountered a problem while processing the request: a missing parameter, a record that could not be found, a business rule that prevents the operation, or an error returned in the script result. If the client checks only the HTTP status, it may record as successful a delivery that the receiving system did not actually complete.
The first rule is therefore to separate at least three questions:
- Did the request reach the server?
- Did the Data API accept and execute the requested operation?
- Did the business process produce the correct, verifiable result?
A serious integration must answer all three. In practice, the client should consider a call successful only after checking the HTTP status, the validity of the JSON, the code contained in the messages array and, when a script was run, the value of scriptError. The script can also return a structured result in scriptResult, including the processing status, the affected record identifier and an operational message where necessary. The calling system should not have to infer the outcome from a simple 200 OK.
A practical validation sequence can always follow the same pattern: confirm that a response arrived, parse the JSON, verify that messages[0].code indicates success, check scriptError when a script was run, and interpret the contents of scriptResult. If any of those checks fails, the delivery must not be marked as complete. The client should store at least the event identifier, the time of the call, the HTTP status, the Data API code, any script error and the final processing state. This turns a technical response into a verifiable operational outcome.

Authentication and the token lifecycle
The Data API session token is not a permanent password. The client opens a session against the database, receives an access token and uses that token in subsequent calls. The token belongs to that session and must be treated as a temporary credential: it should not end up in logs, operator-facing error messages or saved diagnostic payloads.
Login is not just a formality hidden behind a single HTTP request. The integration must distinguish invalid credentials, an account without the required privileges, a disabled Data API, an unreachable database and a token that was not returned or is no longer valid. These are different conditions, with different causes and different corrective actions.
The token also has a lifecycle. A session can be closed explicitly or expire after a period of inactivity. A call that worked a few minutes earlier may therefore fail later, not because the endpoint changed, but because the session is no longer valid. A reliable connector must know when to open a session, how to use the token, when to close it and how to react to expiration without turning the error into an uncontrolled sequence of attempts. A solution may choose short-lived sessions with login and logout for each operation, or reuse a token for a controlled period. In the latter case, it should check the token with validateSession, recognise a 401 response and authenticate again without writing the token to logs.
Operationally, the flow should be bounded: open a session or retrieve a token that is still valid, make the call, validate the response, record the outcome and close the session when the chosen model uses short sessions. If the response is 401, the client should discard the token, authenticate again once and repeat the call only after assessing the risk of duplication. A second 401 should become a visible authentication error, not the beginning of an infinite loop. The token should never be included in diagnostic logs or returned in messages intended for operators.
Timeouts: when not knowing is more dangerous than receiving an error
An HTTP error is often easier to handle than a timeout. If the server responds with an error, the client at least has confirmation that the request was received and rejected or could not be completed. If the timeout expires while the client is waiting for a response, a fundamental question remains: did the server never receive the request, or did it receive the request and continue working without returning the response in time?
The distinction is critical. Imagine WooCommerce sending FileMaker an order event and the call timing out. Retrying immediately may be correct if the first request never left the client. It may instead create a duplicate record, a second activation or two emails to the customer if FileMaker already completed the first operation.
For that reason, a timeout should not automatically be classified as a definite failure. It is an ambiguous state that requires a strategy: record the event, check whether a result already exists for the external identifier, retry only when the conditions allow it and provide a manual review path for cases that cannot be resolved automatically. The client should use separate connection and response timeouts, retain an event identifier and retry only when the operation is idempotent or FileMaker can demonstrate that it has not already been processed. If the outcome cannot be established, it is safer to leave the event in a “needs review” state than to perform a second operation blindly.
The practical procedure is as follows: assign a stable identifier to the event before sending it; record it as pending; after a timeout, query FileMaker or the processing registry using that identifier; if the event is already complete, close the delivery as successful; if it is not present, retry with a progressive delay; if neither outcome can be demonstrated, move it to uncertain and request a review. Automatic retries must have a maximum number of attempts and must not turn a network problem into operational duplication.
Polling does not eliminate the duplication problem
These principles are not limited to integrations that receive notifications or call a REST API. A polling process can produce the same problem. Imagine a business system that checks an external database every few minutes, finds new orders, imports them and finally updates the original order to mark it as processed.
If the process terminates before making that final update, the next cycle still sees the order as new. If the business system creates the record again without checking what has already happened, the same order is duplicated. The fact that the business system is periodically querying the other platform does not eliminate uncertain state: it changes how the event is detected, but not the need to protect the processing operation.
A practical solution is to separate claiming an order from processing it. At the beginning, the process should claim the order with a processing status, an execution identifier and a claim timestamp. The update must be conditional on the previous state, so that only one process can acquire the claim. Orders already marked processing are ignored unless they have remained in that state beyond a safety threshold. This allows an interrupted process to be recovered without leaving the order permanently blocked.
If the source database allows it, a simplified model could look like this:
UPDATE external_orders
SET integration_status = 'processing',
claim_token = :token,
claimed_at = CURRENT_TIMESTAMP,
attempt_count = attempt_count + 1
WHERE external_order_id = :order_id
AND (
integration_status = 'new'
OR (
integration_status = 'processing'
AND claimed_at < CURRENT_TIMESTAMP - INTERVAL 30 MINUTE
)
);
The process continues only if the update changed one row. At the end, it marks the order as complete using the same token:
UPDATE external_orders
SET integration_status = 'completed',
completed_at = CURRENT_TIMESTAMP
WHERE external_order_id = :order_id
AND integration_status = 'processing'
AND claim_token = :token;
The token prevents an old process, finishing late after its claim expired, from closing an order that has meanwhile been assigned to a new attempt. If the source table cannot be changed, the same information can be stored in a separate control table with a unique key on the external order identifier.
The protection must also exist in the business system. The external order identifier must be unique among imported records; line items should have a stable key made from the order identifier and the line identifier. Before creating a new record, the script should look for the existing order and lines. If the order was imported before the timeout, the next attempt should update it or treat it as already processed, rather than creating a second copy. Claiming prevents concurrent processing; idempotency prevents duplication when processing is repeated.
The process should also have a cooperative limit: before starting a new order, it checks the remaining time in the cycle and stops claiming new work as it approaches the timeout. This limit does not replace the unique key or the claim expiration, but it reduces the number of interruptions in the middle of an operation.
Sessions, resources and closing operations
Every Data API call in a real workflow has a before and an after. Before the call there are configuration, authentication and session setup. During the call there is data transfer, script execution and response handling. After the call there are session closure, outcome recording and, where necessary, scheduling another attempt.
Treating only the central call as if it were the entire integration means overlooking resources and intermediate states. A system may authenticate successfully but fail to close the session; it may receive a response but fail to store the useful parts; it may fail after changing the database but before updating its local registry. The design must therefore consider the entire lifecycle, not just the line of code that makes the HTTP request. The minimum sequence should be: open the session, make the call, validate the response, record the outcome and close the session in every case, including when processing ends with an error.
When a script must change several records as one operation, the FileMaker logic can use a transaction with Open Transaction, Commit Transaction and Revert Transaction. In FileMaker Pro, these are script steps in the Script Workspace, which can be opened from Scripts > Script Workspace or File > Manage > Scripts. Search for the script steps and add Open Transaction at the beginning of the block: FileMaker automatically pairs it with the corresponding Commit Transaction; add Revert Transaction in the error path or in the condition that must cancel the operation. The same script steps can run when the script is invoked through the Data API, so they are not commands to send as text in the HTTP request.
The essential structure is similar to this:
Open Transaction
find or create the main record
update related records
check Get ( LastError ) after each critical step
if an error exists:
Revert Transaction
Exit Script with a JSON error result
Commit Transaction
Exit Script with a JSON success result
The important point is that the transaction should contain only operations that FileMaker can commit or revert together. If validation fails, or if the script detects an error, Revert Transaction rolls back the changes inside the block. After Commit Transaction, the script can return a JSON object in scriptResult containing status, the event identifier and the affected records. The transaction protects the consistency of changes inside FileMaker; it cannot undo an email that has already been sent, a REST request that has already been made or any other external side effect. External operations must therefore run after the commit, or have their own state and compensation strategy.
Concurrency: the same event may arrive more than once
In production, events do not necessarily arrive one at a time or in an ideal order. A hook may run more than once, two processes may handle the same order almost simultaneously, or an administrator may repeat a test while an automated delivery is still in progress.
Concurrency creates problems even when each individual call, considered in isolation, returns HTTP 200. Two requests may look for the same customer at the same time, fail to find one and both attempt to create it. Or they may update the same order with different information, in an order that does not match the original event sequence.
A reliable integration must therefore define stable identifiers, data ownership rules and behaviour for duplicate or closely spaced events. In some cases it needs a unique external key, a pre-creation check, a temporary lock or a queue that serialises particular operations. The fact that the Data API runs scripts on the server does not establish the correct order between concurrent events and does not automatically give the received ID a uniqueness guarantee. These rules must be implemented in the FileMaker script, the sender or both. It is not enough to observe that every request received a positive response.
A concrete solution is to introduce an event table or registry with at least event_id, event_type, received_at, status, attempts and record_id. The script checks the event before producing side effects; for create operations, it uses a unique external key and explicitly handles the case where two requests attempt to create it at the same time. For updates, the payload can contain an event version or timestamp, allowing the script to reject an older update that arrived after a newer one. When ordering matters and cannot be handled with a version, the sender must serialise events through a queue.
Idempotency: repeating the request without repeating the effect
Idempotency is the property that allows an operation to be repeated without producing a new unwanted effect every time. It is essential because networks can fail, workers can restart and responses can be lost after the server has already processed the request.

For an order event, the WooCommerce identifier can be part of the key FileMaker uses to recognise the operation. The identifier alone does not solve every problem, however. The integration must define whether the same order can update an existing record, which state transitions are allowed, how to distinguish a new event from a retry, and what to do when two versions of the same event arrive.
Idempotency does not mean ignoring every repeated request. It means deciding what effect a request that has already been seen should have, and making that decision verifiable. A practical approach is to record the event identifier, event type, processing status and related record in FileMaker. Before creating or activating anything, the script looks for the event; if it is already complete, the script returns a result such as already_processed instead of repeating the effect. If the event follows a legitimate change to the same order, the key may also need to include the state transition or event version, not just the order ID. A safe retry is not merely a second call: it is a second call accompanied by a rule that prevents the operation from being duplicated.
That rule must be applied before the irreversible effect. For example, the script can create or locate the event registry entry, set it to processing, perform the transaction on the business records and set it to completed only after a successful commit. If it finds the same event_id already marked completed, it returns already_processed; if it finds processing, it applies a rule for events that may have become stuck, such as an expiration time or manual review. This prevents the system from confusing a new version of an order with a simple retry of the same delivery.
The myth of processing “exactly once”
The most difficult part is not getting a request to FileMaker. It is deciding what should happen when the system that sent the request cannot tell whether the request was completed. Consider a realistic sequence: WooCommerce sends event E123, FileMaker receives it, makes the changes and completes the commit, but the response is lost before it reaches the sender. WooCommerce sees a timeout and retries. From its point of view, the first operation is uncertain; from FileMaker’s point of view, the event has already been processed.
This is why “send once” and “process once” are different problems. An HTTP integration cannot always guarantee exactly-once processing across the entire chain. It can, however, design for at-least-once delivery, idempotent processing and a result that remains queryable after a response is lost. The event registry is therefore more than a log: it is the shared memory that lets the system distinguish a new event from a retry of the same operation.
In practice, the first arrival of E123 creates a record with a processing status. The script applies the business rules and, after verified completion, stores completed, the affected record and the result that should be returned to the sender. If a later request contains the same event_id, the script does not automatically repeat the effect: it checks the existing state and can respond with already_processed together with the original result. If it finds processing, it needs a rule to distinguish work that is still running from an execution that has become stuck, for example by using a timestamp, an expiration time or manual review.
This model separates at least four moments that are often confused: the request was sent, the server received it, the operation was completed and the sender received the confirmation. The HTTP status describes only part of that sequence. A lost response should therefore not force the sender to choose between risking a duplicate and abandoning the event: it should be able to query the outcome using the event identifier.
The same reasoning clarifies the limit of transactions. A FileMaker transaction can protect several changes to the solution’s records when using the script steps available from FileMaker Pro 19.6.1. It cannot undo an email that has already been sent, a REST request that has already been made or an action performed by an external service. Those effects must be treated as subsequent, observable operations. One possible model is an outbox: the script records the external action to be performed, a process sends it, stores the outcome and retries it using an idempotency key. This prevents the external delivery from being confused with the commit of the business data.
The same fundamental principle can also be applied on FileMaker Pro 19.5 by recording the event, using a stable external key and preventing duplicates in the script. What is missing is the atomic guarantee provided by the transactions introduced in 19.6.1: changes to several records must therefore be designed with greater care, explicit intermediate states and recovery procedures. Upgrading the platform can strengthen the model, but it does not replace the design of the event identity and lifecycle.
Managing failures instead of hiding them
A reliable integration is not one that never fails. It is one that recognises different types of failure and reacts proportionately.
An authentication or configuration error should not be retried indefinitely. A timeout or temporary network error may require another attempt with progressive delay. An invalid payload must be recorded and brought to the attention of someone who can correct the data. A FileMaker script error must remain distinguishable from a transport error. An event that cannot be resolved automatically must end in a visible state, not disappear into a log that nobody reviews.
This requires at least a delivery status, an attempt count, a concise last error and an event identifier. Logs should make it possible to reconstruct what happened without exposing passwords, tokens or unnecessary personal data. The diagnosis should answer concrete questions: which event was sent, when, to which destination, with what result and what happened after the failure? On the FileMaker side, the administrator can also use Data API client monitoring and the server’s Data API logs. On the connector side, the integration needs application logs and a persistent delivery state. The two sources are not interchangeable: the server log shows what FileMaker saw, while the connector’s registry must explain why the event was sent, retried or put on hold.
It is also useful to separate reactions by error class. A 401 requires controlled session renewal; a configuration, permission or payload-validation error requires correction rather than an endless retry; a 429, a temporary 5xx error or a network problem may be retried with backoff; a timeout requires reconciliation first, because the outcome may already have been produced. This classification must be encoded in the connector rather than left to the manual interpretation of each operator.
From a positive test to production reliability
A test that returns HTTP 200 is a good starting point, but it is not a completion criterion. To consider an integration reliable, test how the system behaves when the token expires, when the response is delayed, when the same event arrives twice, when the script returns an error, when two processes work concurrently and when a delivery must be retried or sent for manual review. A minimum test matrix should include at least: a negative application result with HTTP 200, an expired token, a disabled Data API, a timeout after sending, a duplicate event, two concurrent requests, an invalid payload and recovery after a temporary error.
The difference between a technically working connection and an integration ready for production lies in the ability to manage uncertainty. The request must have a verifiable meaning, its effect must not be duplicated by a retry and every failure must leave a useful trail for recovery. Only then does a positive response become one part of a reliable process rather than a premature conclusion.