Text Diff

Compare two text strings and highlight the differences.

Endpoint

POST https://www.acrewity.com/api/services/execute

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

n8n Integration

This service is also available via our n8n community node: @acrewity/n8n-nodes-acrewity

Operations

Compare Text

Compare two text strings line by line and identify differences.

Operation ID: compare_text

Parameters

Parameter Type Required Default Description
text1 string Yes - First text to compare (original)
text2 string Yes - Second text to compare (modified)

Example Request

Compare Configuration Files:

{
  "service": "text-diff",
  "operation": "compare_text",
  "parameters": {
    "text1": "server:\n  port: 3000\n  host: localhost\n  debug: true",
    "text2": "server:\n  port: 8080\n  host: 0.0.0.0\n  debug: false\n  ssl: true"
  }
}

Compare Document Versions:

{
  "service": "text-diff",
  "operation": "compare_text",
  "parameters": {
    "text1": "The quick brown fox jumps over the lazy dog.",
    "text2": "The quick red fox leaps over the sleepy dog."
  }
}

Example Response

{
  "success": true,
  "result": {
    "data": {
      "diff": [
        { "type": "unchanged", "line": "server:", "line_number": 1 },
        { "type": "removed", "line": "  port: 3000", "line_number": 2 },
        { "type": "added", "line": "  port: 8080", "line_number": 2 },
        { "type": "removed", "line": "  host: localhost", "line_number": 3 },
        { "type": "added", "line": "  host: 0.0.0.0", "line_number": 3 },
        { "type": "removed", "line": "  debug: true", "line_number": 4 },
        { "type": "added", "line": "  debug: false", "line_number": 4 },
        { "type": "added", "line": "  ssl: true", "line_number": 5 }
      ],
      "stats": {
        "lines_added": 4,
        "lines_removed": 3,
        "lines_unchanged": 1
      },
      "total_changes": 7
    }
  },
  "credits_used": 1
}

More Examples

See Data Transformation Examples for complete workflow examples including version comparison, code review automation, and document change tracking.