### Retrieve Validation Badge using GET Source: https://csvlint.io/api Request a visual validation status badge in SVG or PNG format. ```bash curl -X GET "http://csvlint.io/validate?csvUrl=http://example.com/mydata.csv&format=svg" ``` -------------------------------- ### Example CSV Data Structure Source: https://csvlint.io/about Illustrates a typical CSV file structure with a header row and data rows, using commas as delimiters. ```csv OrganisationId,WeekDay,Times,IsOpen,OpeningTimeType 1186,Monday,09:30-13:00,True,General 1186,Monday,13:30-17:30,True,General ... ``` -------------------------------- ### Validate CSV via URL using GET Source: https://csvlint.io/api Perform validation for remotely hosted files using query parameters. ```bash curl -X GET "http://csvlint.io/validate?csvUrl=http://example.com/mydata.csv&schemaUrl=http://example.com/myschema.json" ``` -------------------------------- ### Example JSON Table Schema for CSVLint Source: https://csvlint.io/about This schema defines fields for 'OrganisationId', 'WeekDay', 'Times', 'IsOpen', and 'OpeningTimeType' with specific constraints for each. Use this as a template for your CSVLint schemas. ```json { "fields": [ { "name": "OrganisationId", "title": "Organisation ID", "constraints": { "required": true, "type": "http://www.w3.org/TR/xmlschema-2/#int" } }, { "name": "WeekDay", "title": "Day of the week", "constraints": { "required": true, "pattern": "(Mon|Tue|Wednes|Thurs|Fri|Satur|Sun)day" } }, { "name": "Times", "constraints": { "required": true, "pattern": "(0[0-9]|1[0-2]):[0-5][0-9]-(0[0-9]|1[0-2]):[0-5][0-9]" } }, { "name": "IsOpen", "title": "Open?", "constraints": { "required": true, "pattern": "(True|False)" } }, { "name": "OpeningTimeType", "title": "General or additional opening", "constraints": { "required": true, "pattern": "(General|Additional)" } } ] } ``` -------------------------------- ### GET /validate Source: https://csvlint.io/api Validates a CSV file by providing URLs for the CSV and schema directly in the query parameters, with optional dialect settings and badge generation. ```APIDOC ## GET /validate ### Description This endpoint allows you to validate a CSV file by providing URLs for the CSV and schema directly in the query parameters, along with optional dialect settings. This is useful for integrations where files are hosted remotely. ### Method GET ### Endpoint /validate ### Parameters #### Query Parameters - **csvUrl** (string) - Required - URL of the CSV file to validate. - **schemaUrl** (string) - Optional - URL of a JSON schema for the CSV structure. - **Dialect Options** (string) - Optional - Optional CSV dialect options as query parameters (e.g., delimiter, doubleQuote, lineTerminator). - **format** (string) - Optional - Set to 'svg' or 'png' to receive a badge representing the validation result. ### Request Example curl -X GET "http://csvlint.io/validate?csvUrl=http://example.com/mydata.csv&schemaUrl=http://example.com/myschema.json" ``` -------------------------------- ### Validate CSV with Dialect Options using POST Source: https://csvlint.io/api Customize CSV parsing by providing dialect parameters like delimiter and header settings. ```bash curl -X POST http://csvlint.io/validate \ -H "Accept: application/json" \ -F "file=@/path/to/yourfile.csv" \ -F "delimiter=;" \ -F "header=true" ``` -------------------------------- ### Display Below Minimum Value Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_perfect.csv&schemaUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2FstudentsSchema.json Shows the specific value that failed the minimum constraint check. ```text 12 ``` -------------------------------- ### Validate CSV via File Upload using POST Source: https://csvlint.io/api Upload local CSV and schema files directly to the API for validation. ```bash curl -X POST http://csvlint.io/validate \ -H "Accept: application/json" \ -F "file=@/path/to/yourfile.csv" \ -F "schema=@/path/to/yourschema.json" ``` -------------------------------- ### Validate simple student list CSV Source: https://csvlint.io/examples A standard CSV file with headers and rows that should pass validation without errors. ```csv Name,Age,Grade,Enrolled Alice,20,A,true Bob,22,D,false Charlie,12,C,true Mike,20,C,true ``` -------------------------------- ### Validate CSV via URL using POST Source: https://csvlint.io/api Use this request to validate a CSV file hosted at a public URL with an optional schema URL. ```bash curl -X POST http://csvlint.io/validate \ -H "Accept: application/json" \ -F "csvUrl=http://example.com/mydata.csv" \ -F "schemaUrl=http://example.com/myschema.json" ``` -------------------------------- ### JSON Response Format Source: https://csvlint.io/api The API returns a JSON object detailing the validation status of a CSV file when the `Accept` header is set to `application/json`. ```APIDOC ## Response Format (JSON) If the `Accept` header is set to `application/json`, the API will respond with JSON in the following format: ```json { "version": "0.2", "licence": "http://opendatacommons.org/licenses/odbl/", "validation": { "source": "http://example.com/mydata.csv", "schema": "http://example.com/myschema.json", "state": "invalid", "errors": [ { "type": "undeclared_header", "category": "structure", "row": null, "col": null } ], "warnings": [ { "type": "header_name", "category": "schema", "row": null, "col": 1 } ], "info": [ { "type": "assumed_header", "category": "structure", "row": null, "col": null } ] } } ``` ``` -------------------------------- ### Validate CSV with mixed data types Source: https://csvlint.io/examples Demonstrates a validation scenario where the age column contains non-numeric data, triggering warnings. ```csv Name,Age,Grade,Enrolled Alice,20,A,true Bob,22,D,false Charlie,12,C,true Mike,Twenty,C,true ``` -------------------------------- ### Embed Validation Badge Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_perfect.csv&schemaUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2FstudentsSchema.json HTML snippet to display a CSV validation status badge on an external website. ```html CSV Validation Badge ``` -------------------------------- ### POST /validate Source: https://csvlint.io/api Validates a CSV file provided as a URL or file upload, with an optional schema for validation. ```APIDOC ## POST /validate ### Description This endpoint validates a CSV file provided as a URL or file upload, with an optional schema for validation. ### Method POST ### Endpoint /validate ### Parameters #### Request Body - **csvUrl** (string) - Optional - URL of the CSV file to validate (optional if uploading a file). - **file** (file) - Optional - CSV file upload for validation (optional if using a URL). - **schemaUrl** (string) - Optional - URL of a JSON schema for the CSV structure (optional). - **schema** (file) - Optional - JSON schema file upload for the CSV structure (optional). - **Dialect Options** (object) - Optional - Optional CSV dialect options to customize validation. ### Request Example curl -X POST http://csvlint.io/validate \ -H "Accept: application/json" \ -F "csvUrl=http://example.com/mydata.csv" \ -F "schemaUrl=http://example.com/myschema.json" ``` -------------------------------- ### Embed CSV Validation Badge Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_perfect.csv Use this HTML snippet to display a dynamic validation status badge on your website. ```html CSV Validation Badge ``` -------------------------------- ### CSV Lint API JSON Response Format Source: https://csvlint.io/api This JSON structure is returned when the API's Accept header is set to application/json. It details the validation status, source, schema, and any errors, warnings, or informational messages. ```json { "version": "0.2", "licence": "http://opendatacommons.org/licenses/odbl/", "validation": { "source": "http://example.com/mydata.csv", "schema": "http://example.com/myschema.json", "state": "invalid", "errors": [ { "type": "undeclared_header", "category": "structure", "row": null, "col": null } ], "warnings": [ { "type": "header_name", "category": "schema", "row": null, "col": 1 } ], "info": [ { "type": "assumed_header", "category": "structure", "row": null, "col": null } ] } } ``` -------------------------------- ### Display Invalid Enum Value Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_perfect.csv&schemaUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2FstudentsSchema.json Shows the specific invalid value identified during schema validation. ```text D ``` -------------------------------- ### Embed Badge Code Source: https://csvlint.io/api You can embed a badge on your website to display the validation status of a CSV file. ```APIDOC ## Embed Badge Code You can also directly embed a badge on your website to show its validation status. #### Example Embed Code ```html CSV Validation Badge ``` ``` -------------------------------- ### CSV Data with Quoted Fields Source: https://csvlint.io/about Demonstrates how fields containing commas, line endings, or double quotes are escaped by wrapping them in double quotes. Any double quotes within such fields are doubled up. ```csv OrganisationCode,OrganisationName,Address1,Address2,Address3,City,County,Postcode 1-231076921,"Next Stage ""A Way Forward"" Ltd",Head Office,"HR House, 28 Manchester Road",Westhoughton,Bolton,Lancashire,BL5 3QJ ... ``` -------------------------------- ### Validate CSV with pipe separator Source: https://csvlint.io/examples Shows a valid CSV file that uses the pipe character as a delimiter instead of a comma. ```csv Name|Age|Grade|Enrolled Alice,C|20|A|true Bob,A|22|D|false Charlie,D|12|C|true Mike,W|20|C|true ``` -------------------------------- ### Embed CSV Validation Badge HTML Source: https://csvlint.io/api Use this HTML snippet to embed a badge on your website that displays the validation status of a CSV file and links to its detailed results. ```html CSV Validation Badge ``` -------------------------------- ### Embed CSV Validation Badge Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_warnings.csv Use this HTML code to embed a badge that links to the validation results of a specific CSV file on your website. ```html CSV Validation Badge ``` -------------------------------- ### Embed CSV Validation Badge Source: https://csvlint.io/validate?csvUrl=https%3A%2F%2Fcsvlint.io%2Fexamples%2Fstudents_pipe.txt&delimiter=%7C Copy this HTML code to embed a badge displaying the CSV validation status on your website. The badge links to the validation results page. ```html CSV Validation Badge ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.