The ingestion process is a crucial part of NOMS that deals with the acquisition of order data from various sources. This process is facilitated by 'mappers', which are modules provided by the client. These mappers act as translators between your system's data structure and NOMS, ensuring seamless data flow into the platform.

The ingestion process usually is initiated after the payment has been completed (for example, through a payment gateway like Stripe). This section will delve deeper into the details of the ingestion process.

The Role of Mappers

Mappers are pieces of software that convert the structure and format of your system's data to match NOMS' expected input format. They are responsible for parsing the data from your system, mapping it to the required NOMS fields, and sending it to the NOMS ingestion API.

Your team or your software vendor is responsible for providing these mappers. NOMS is agnostic to the specific technology or language used to write these mappers, as long as they conform to the requirements outlined in the NOMS OpenAPI documentation.

Mapper Implementation

  1. Mapping the Data:
    After a successful checkout, your system should trigger the mapper with the necessary data payload. The mapper then maps your order data to the expected format defined by NOMS.

  2. Sending the Data:
    The mapper then sends a POST request to the NOMS ingest API endpoint. It should include the mapped data in the request body and the NOMS API key in the header. Here's an example:

    curl --request POST \
      --url https://noms.api.nacelle.com/v1/orders \
      --header 'accept: application/json' \
      --header 'content-type: application/json' \
      --header 'Authorization: YOUR_API_KEY' \
      --header 'X-Nacelle-Space-Id: YOUR_SPACE_ID' \
      --data '{"currency":"USD"}'
    
    url := "https://noms.api.nacelle.com/v1/orders"
    
    payload := strings.NewReader("{\"currency\":\"USD\"}")
    
    req, _ := http.NewRequest("POST", url, payload)
    
    req.Header.Add("accept", "application/json")
    req.Header.Add("content-type", "application/json")
    req.Header.Add("X-Nacelle-Space-Id", "YOUR_SPACE_ID")
    req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
    
    res, _ := http.DefaultClient.Do(req)
    
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    
    fmt.Println(string(body))
    
  3. Ingestion Confirmation:
    If the ingestion process is successful, the NOMS server will return a 200 OK status code, along with the details of the ingested order data. If there are any errors, an appropriate status code and error message will be returned.

Key Considerations

  • Error Handling: Your mappers should be robust and capable of handling any errors that may arise during the mapping or ingestion process. It's recommended to log these errors for debugging and resolution.
  • Data Consistency: Ensure your mappers correctly map every necessary field to maintain data consistency and avoid ingestion errors.
  • Data Security: Ensure secure transmission of data by using secure protocols (HTTPS) and NOMS API key authentication during the ingestion process.

Remember, a well-implemented ingestion process is critical to the efficient functioning of NOMS and your overall order management flow. By following these steps and considerations, you can achieve a seamless, secure, and efficient ingestion process.