Skip to content

Instantly share code, notes, and snippets.

@adamgoucher
Created April 6, 2012 04:07
Show Gist options
  • Save adamgoucher/2316754 to your computer and use it in GitHub Desktop.
Save adamgoucher/2316754 to your computer and use it in GitHub Desktop.
HAR Format Schema
{
"type": "object",
"properties": {
"log": {
"description": "HTTP Archive structure.",
"type": "object",
"properties": {
"version": {
"description": "HAR format version",
"type": "string",
"required": true
},
"creator": {
"description": "Name and version info of the log creator app.",
"type": "object",
"required": true,
"properties": {
"name": {
"type": "string",
"required": true
},
"version": {
"type": "string",
"required": true
},
"comment": {
"type": "string",
"optional": true
}
}
},
"browser": {
"description": "Name and version info of used browser.",
"type": "object",
"optional": true,
"properties": {
"name": {
"type": "string",
"required": true
},
"version": {
"type": "string",
"required": true
},
"comment": {
"type": "string",
"optional": true
}
}
},
"pages": {
"description": "Exported web page",
"optional": true,
"properties": {
"startedDateTime": {
"type": "string",
"pattern": "/^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))/",
"required": true
},
"id": {
"type": "string",
"unique": true,
"required": true
},
"title": {
"type": "string",
"required": true
},
"pageTimings": {
"description": "Timing info about page load",
"type": "object",
"required": true,
"properties": {
"onContentLoad": {
"type": "number",
"min": -1
},
"onLoad": {
"type": "number",
"min": -1
},
"comment": {
"type": "string"
}
}
},
"comment": {
"type": "string"
}
}
},
"entries": {
"description": "Request and Response related info",
"type": "array",
"required": true,
"items": {
"type": "object",
"properties": {
"pageref": {
"type": "string"
},
"startedDateTime": {
"type": "string",
"required": true,
"pattern": "/^(\\d{4})(-)?(\\d\\d)(-)?(\\d\\d)(T)?(\\d\\d)(:)?(\\d\\d)(:)?(\\d\\d)(\\.\\d+)?(Z|([+-])(\\d\\d)(:)?(\\d\\d))/"
},
"time": {
"type": "integer",
"required": true,
"min": 0
},
"request" : {
"description": "Monitored request",
"required": true,
"properties": {
"method": {
"type": "string",
"required": true
},
"url": {
"type": "string",
"required": true
},
"httpVersion": {
"type" : "string",
"required": true
},
"cookies" : {
"type": "array",
"required": true,
"items": {
"description": "Cookie description.",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"path": {
"type": "string"
},
"domain" : {
"type": "string"
},
"expires" : {
"type": "string"
},
"httpOnly" : {
"type": "boolean"
},
"secure" : {
"type": "boolean"
},
"comment": {
"type": "string"
}
}
}
},
"headers" : {
"type": "array",
"required": true,
"items": {
"description": "Helper name-value pair structure.",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"comment": {
"type": "string"
}
}
}
},
"queryString" : {
"type": "array",
"required": true,
"items": {
"description": "Helper name-value pair structure.",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"comment": {
"type": "string"
}
}
}
},
"postData" : {
"description": "Posted data info.",
"optional": true,
"type": "object",
"properties": {
"mimeType": {
"type": "string",
"required": true
},
"text": {
"type": "string"
},
"params": {
"type": "array",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string"
},
"fileName": {
"type": "string"
},
"contentType": {
"type": "string"
},
"comment": {
"type": "string"
}
}
},
"comment": {
"type": "string"
}
}
},
"headersSize" : {
"type": "integer",
"required": true
},
"bodySize" : {
"type": "integer",
"required": true
},
"comment": {
"type": "string"
}
}
},
"response" : {
"description": "Monitored Response.",
"required": true,
"properties": {
"status": {
"type": "integer",
"required": true
},
"statusText": {
"type": "string",
"required": true
},
"httpVersion": {
"type": "string",
"required": true
},
"cookies" : {
"type": "array",
"required": true,
"items": {
"description": "Cookie description.",
"type": "object",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"path": {
"type": "string"
},
"domain" : {
"type": "string"
},
"expires" : {
"type": "string"
},
"httpOnly" : {
"type": "boolean"
},
"secure" : {
"type": "boolean"
},
"comment": {
"type": "string"
}
}
}
},
"headers" : {
"type": "array",
"required": true,
"items": {
"description": "Helper name-value pair structure.",
"properties": {
"name": {
"type": "string",
"required": true
},
"value": {
"type": "string",
"required": true
},
"comment": {
"type": "string"
}
}
}
},
"content" : {
"type": "object",
"description": "Response content",
"required": true,
"properties": {
"size": {
"type": "integer",
"required": true
},
"compression": {
"type": "integer"
},
"mimeType": {
"type": "string",
"required": true
},
"text": {
"type": "string"
},
"encoding": {
"type": "string"
},
"comment": {
"type": "string"
}
}
},
"redirectURL" : {
"type": "string",
"required": true
},
"headersSize" : {
"type": "integer",
"required": true
},
"bodySize" : {
"type": "integer",
"required": true
},
"comment": {
"type": "string"
}
}
},
"cache" : {
"required": true,
"type": "object",
"description": "Info about a response coming from the cache.",
"properties": {
"beforeRequest": {
"type": "object",
"optional": true,
"description": "Info about cache entry.",
"properties": {
"expires": {
"type": "string"
},
"lastAccess": {
"type": "string",
"required": true
},
"eTag": {
"type": "string",
"required": true
},
"hitCount": {
"type": "integer",
"required": true
},
"comment": {
"type": "string"
}
}
},
"afterRequest": {
"type": "object",
"optional": true,
"description": "Info about cache entry.",
"properties": {
"expires": {
"type": "string"
},
"lastAccess": {
"type": "string",
"required": true
},
"eTag": {
"type": "string",
"required": true
},
"hitCount": {
"type": "integer",
"required": true
},
"comment": {
"type": "string"
}
}
},
"comment": {
"type": "string"
}
}
},
"timings" : {
"required": true,
"description": "Info about request-response timing.",
"properties": {
"dns": {
"type": "integer",
"min": -1,
"required": true
},
"connect": {
"type": "integer",
"min": -1,
"required": true
},
"blocked": {
"type": "integer",
"min": -1,
"required": true
},
"send": {
"type": "integer",
"min": -1,
"required": true
},
"wait": {
"type": "integer",
"min": -1,
"required": true
},
"receive": {
"type": "integer",
"min": -1,
"required": true
},
"ssl": {
"type": "integer",
"min": -1
},
"comment": {
"type": "string"
}
}
},
"serverIPAddress" : {
"type": "string"
},
"connection" : {
"type": "string"
},
"comment": {
"type": "string"
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment