{
"id": 12,
"name": "Political Ads"
}
Creates and returns json data about a single new matching project.
/projects
POST
None
name
: A unique name for the project.
{
"name" : "Political Ads"
}
Code | Content |
---|---|
200 | Project Object JSON |
Code | Content |
---|---|
400 | { error : "Project name already exists" } |
$.ajax({
url: "/projects",
dataType: "json",
data: [
"name": "Political Ads"
]
type : "POST",
success : function(r) {
console.log(r);
}
});
Returns json data about a single project.
/projects/:id
GET
id
: The ID of the project being retrieved.
None
Code | Content |
---|---|
200 | Project Object JSON |
Code | Content |
---|---|
404 | { error : "The requested object could not be found" } |
$.ajax({
url: "/projects/1",
dataType: "json",
type : "GET",
success : function(r) {
console.log(r);
}
});
{
"id": 12,
"match_categorization": {
"is_potential_target": true,
"is_corpus": false,
"is_distractor": false,
"is_target": false
},
"tasks": [],
"project_id": 12,
"media_path": "",
"afpt_path": ""
}
Creates and returns json data about a single new media project.
/media
POST
None
project_id
: The ID of the project that the media file will be compared withmedia_path
: A path to the media file itself. This path can be in the following format:- Network path:
ssh://user@example.domain/path/to/file/from/root
which will result in an rsync to retrieve the file.
- Network path:
afpt_path
: A path to the pre-processed audio fingerprint file. See themedia_path
documentation for format details.
{
"project_id": 12,
"media_path": "ssh://jdoe@example.com/home/jdoe/media/rickroll.mp3",
"afpt_path": "ssh://jdoe@example.com/home/jdoe/media/rickroll.afpt"
}
Code | Content |
---|---|
200 | Media Object JSON |
Code | Content |
---|---|
400 | { error : "You did not include all required fields" } |
$.ajax({
url: "/media",
dataType: "json",
data: [
"name": "Political Ads"
]
type : "POST",
success : function(r) {
console.log(r);
}
});
/media/:id
GET
id
: the identifier for a media record.
None
Code | Content |
---|---|
200 | Media Object JSON |
Code | Content |
---|---|
404 | { error : "The requested object could not be found" } |
$.ajax({
url: "/media/12",
dataType: "json",
type : "GET",
success : function(r) {
console.log(r);
}
});
{
"id": 12,
"media_id": 12,
"type": "match",
"status": {
"code": 0,
"description": "New task."
},
"result": {
"code": 1,
"data": {},
"output": [
"Lines of output",
"from the process"
]
}
}
Code | Description |
---|---|
0 | New task |
1 | Starting |
2 | In Progress |
3 | Finished |
-1 | Failed |
Code | Description |
---|---|
1 | Success |
0 | Fail |
match
: compare the media with the project fingerprints.
"data": {
"matches": [{
"media_id": 13,
"start_time": 15.32,
"duration": 30,
}],
"segments": [{
"segment_type": "potential_target",
"start_time": "",
"duration": ""
}]
}
corpus_add
: save the media as a corpus item.potential_target_add
: add the media as a potential target item.distractor_add
: add the media as a distractor item.target_add
: add the media as a target item.
####### Match results
Once media is registered in the system it can be processed using fingerprinting and matching algorithms. These activities can be intense, so they are handled by a task queue (instead of being synchronous).
/tasks
POST
None
media_id
: The ID of the media file that this task will be invoked on.type
: The type of task to be performed (see "MediaTask Types")
None
{
"media_id": 12,
"type": "match"
}
Code | Content |
---|---|
200 | MediaTask Object JSON |
Code | Content |
---|---|
400 | { error : "You did not include all required fields" } |
$.ajax({
url: "/tasks",
dataType: "json",
data: [
"media_id": 12,
"type": "match"
]
type : "POST",
success : function(r) {
console.log(r);
}
});
/tasks/:id
GET
id
: The ID of the task being retrieved.
None
Code | Content |
---|---|
200 | Project Object JSON |
Code | Content |
---|---|
404 | { error : "The requested object could not be found" } |
$.ajax({
url: "/tasks/12",
dataType: "json",
type : "GET",
success : function(r) {
console.log(r);
}
});