Compare Text

If you need to compare two texts in your interface, ActiveCollab offers a simple way to achieve that without implementing another diff tool:

Response: HTTP 200, application/json (Hide)
POST /compare-text

Payload:

1
2
3
4
{
    "before": "Diff is using character granularity",
    "after": "Diff is using word granularity"
}

Response:

1
2
3
4
5
{
    "before": "Diff is using character granularity",
    "after": "Diff is using word granularity",
    "diff": "Diff is using <del>character <\/del><ins>word <\/ins>granularity"
}

Please note that HTML will be converted to plain text representation and than compared. Diff result is always HTML:

Response: HTTP 200, application/json (Hide)
POST /compare-text

Payload:

1
2
3
4
{
    "before": "<p>The quick brown fox<\/p><p><b>jumps<\/b> over the lazy dog<\/p>",
    "after": "<p>The quick grey elephant<\/p><p>jumps over the busy snake<\/p>"
}

Response:

1
2
3
4
5
{
    "before": "The quick brown fox\n\nJUMPS over the lazy dog",
    "after": "The quick grey elephant\n\njumps over the busy snake",
    "diff": "The quick <del>brown fox<br>\n<br>\nJUMPS <\/del><ins>grey elephant<br>\n<br>\njumps <\/ins>over the <del>lazy dog<\/del><ins>busy snake<\/ins>"
}