{"mode":"words","changes":{"added_blocks":1,"removed_blocks":0,"equal":2},"diff":[{"value":"hello ","added":false,"removed":false},{"value":"brave ","added":true,"removed":false},{"value":"world","added":false,"removed":false}],"unified_patch":"===================================================================\n--- a\n+++ b\n@@ -1,1 +1,1 @@\n-hello world\n\\ No newline at end of file\n+hello brave world\n\\ No newline at end of file\n"}
curl --location --request POST 'https://zylalabs.com/api/13164/text+difference+and+patch+api/26710/compare+two+texts' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{"a": "hello world", "b": "hello brave world", "mode": "words"}'
Após se cadastrar, cada desenvolvedor recebe uma chave de acesso à API pessoal, uma combinação única de letras e dígitos para acessar nosso endpoint de API. Para autenticar com a Text Difference and Patch API basta incluir seu token Bearer no cabeçalho Authorization.
| Cabeçalho | Descrição |
|---|---|
Authorization
|
Obrigatório
Deve ser Bearer access_key. Veja "Sua chave de acesso à API" acima quando você estiver inscrito.
|
Sem compromisso de longo prazo. Faça upgrade, downgrade ou cancele a qualquer momento. O teste gratuito inclui até 50 requisições.
(Economize 2 meses com cobrança anual 🎉)
Empresas líderes confiam em nós
See exactly what changed between two texts. One call compares them by lines, words or characters and returns both a structured, machine readable difference and a unified patch string, the same format version control tools use.
Useful for tracking revisions of contracts, articles and documentation, audit logs that must show exactly what changed, review robots for configuration files, and detecting content changes in monitored pages.
The Compare Two Texts endpoint returns a structured difference between two texts, including parts flagged as added or removed, a summary count of changes, and a unified patch string. This allows users to see exactly what has changed in a clear format.
Key fields in the response include "mode" (indicating the granularity), "changes" (with counts of added and removed blocks), "diff" (showing individual text segments with flags), and "unified_patch" (the formatted patch string).
The response data is organized into a JSON structure. It includes a summary of changes, a detailed list of differences with flags for added or removed text, and a unified patch string formatted for easy application or storage.
Os usuários podem especificar o parâmetro "modo" para escolher a granularidade da comparação: linha, palavra ou caractere Isso permite comparações personalizadas com base no nível de detalhe necessário
Casos de uso típicos incluem rastrear revisões em contratos revisar mudanças em artigos manter registros de auditoria para documentação e monitorar mudanças de conteúdo em páginas da web garantindo rastreamento de mudanças preciso
Os usuários podem utilizar os dados retornados analisando o "diff" para alterações específicas aplicando o "unified_patch" para atualizar documentos ou gerando relatórios com base nas contagens resumidas de blocos de texto adicionados e removidos
Data accuracy is maintained by performing in-memory comparisons without storing the texts, ensuring that only the current state of the texts is analyzed, thus providing reliable and immediate results.
Users can expect a consistent structure in the response, with "added" and "removed" flags clearly indicating changes, and a unified patch that follows a standard format similar to version control systems, making it easy to interpret.