We would like to express our deep gratitude to the following projects PHP, Yii Framework, MySQL, Nginx, Memcached, Sphinx Search thanks to them Factopedia was created.
If you like to make Factopedia better, then join us. Right now you can help us to translate Factopedia into your native language, or fill the encyclopedia with the necessary content. To create new objects, you can use our RESTful API, which is available by the url https://api.factopedia.org. If you want to participate in Factopedia development, please contact us.
Accept: application/json; q=1.0, */*; q=0.1
Data will be returned in JSON format, otherwise in XML
expand: getting additional data;
filter: filter results, searching *;
sort: sorting listing *;
* available only on endpoints which returns collections
each endpoint has its own values of expand parameter, see possible values in the endpoint description.
filter has the following format
filter[name]{[operator]}=value
{} operator is optional
sort has the following format
sort=name
name - field name. Default sort is ASC, from smaller to larger, if you want to sort in reverse order use "-" before field name, for example sort=-name
GET /objects: listing of objects, by pages;
POST /objects: creating new object;
GET /objects/123: object 123 data;
PATCH /objects/123 or PUT /objects/123: updating object 123;
name
parentId
lang
property
This allows you to search objects by name, in certain categories and by property value. `property` can be used only with `parentId`for searching objects in categories. It is an array where keys are property id, and the value is an miltidimentional array with filter options (see example below to make a correct filtering by properties values). By defaul objects sorted by name, but it's also possible to sort by object property, for example `sort=-67_object` this means that objects will be sorted in DESC order '-' minus sign in the beggining, by the property with id = '67' and type = 'object'
Possible values for additional parameters
expand
properties
suggestedProperties
parents
children
countChildren
images
Usage example
GET /objects?expand=properties,suggestedProperties,parents,children&sort=-67_object&name=example&parentId=123&lang=en&property[65][int][][>=]=1980&property[65][int][][<=]=1981&property[62][int][][%3D]=7&property[62][int][][%3D]=8
name: object name (*);
lang: language, two-letter format (*);
descriptions: object description;
main_image: md5 checksum of image file;
aliases[]: other object names;
parents[][Objects][id]: parent object (category);
children[][Objects][id]: children objects, objects descended from this object;
Objects[imageFiles][]: image files;
objectsPropertiesValues[n][ObjectsPropertiesValues][name]: each property data, n - property ID, possible values of name field see in /properties endpoint description
required fields:
objectsPropertiesValues[n][ObjectsPropertiesValues][property_id]: property ID, property need to be added to the data base before linking the property with any object. To check is property already exists or create a new property you can with /properties endpoint
possible field values type:
int, dec, range_int, range_dec, bool, text, object, array, array_of_objects, dynamic
Links[n][url]: link for the property, n - property ID;
For example:
POST /objects
?name=foo
&lang=en
&description=bar
&aliases[]=foobar
&aliases[]=barfoo
&parents[][Objects][id]=123
&children[][Objects][id]=234
&objectsPropertiesValues[12][ObjectsPropertiesValues][property_id]=12
&objectsPropertiesValues[12][ObjectsPropertiesValues][category_id]=11
&objectsPropertiesValues[12][ObjectsPropertiesValues][unit_id]=21
&objectsPropertiesValues[12][ObjectsPropertiesValues][type]=int
&objectsPropertiesValues[12][ObjectsPropertiesValues][value]=4321
&objectsPropertiesValues[12][ObjectsPropertiesValues][order_by]=1
&objectsPropertiesValues[13][ObjectsPropertiesValues][property_id]=13
&objectsPropertiesValues[12][ObjectsPropertiesValues][category_id]=11
&objectsPropertiesValues[13][ObjectsPropertiesValues][unit_id]=31
&objectsPropertiesValues[13][ObjectsPropertiesValues][type]=bool
&objectsPropertiesValues[13][ObjectsPropertiesValues][value]=1
&objectsPropertiesValues[13][ObjectsPropertiesValues][order_by]=2
&objectsPropertiesValues[14][ObjectsPropertiesValues][property_id]=14
&objectsPropertiesValues[14][ObjectsPropertiesValues][type]=array_of_objects
&objectsPropertiesValues[14][ObjectsPropertiesValues][value][0]=31
&objectsPropertiesValues[14][ObjectsPropertiesValues][value][1]=219
&objectsPropertiesValues[14][ObjectsPropertiesValues][value][2]=42229
&objectsPropertiesValues[15][ObjectsPropertiesValues][property_id]=15
&objectsPropertiesValues[15][ObjectsPropertiesValues][type]=array_of_objects
&objectsPropertiesValues[15][ObjectsPropertiesValues][value][0]=31
&objectsPropertiesValues[15][ObjectsPropertiesValues][value][1]=219
&objectsPropertiesValues[15][ObjectsPropertiesValues][value][2]=42229
&objectsPropertiesValues[15][ObjectsPropertiesValues][valueArrayOfObjects][3][Objects][name]=NewObjectName // Will try to create a new object in the same category as other objects that already exists
&objectsPropertiesValues[15][ObjectsPropertiesValues][value][3]=
&objectsPropertiesValues[16][ObjectsPropertiesValues][property_id]=16
&objectsPropertiesValues[16][ObjectsPropertiesValues][type]=array
&objectsPropertiesValues[16][ObjectsPropertiesValues][value][0]=value1
&objectsPropertiesValues[16][ObjectsPropertiesValues][value][1]=value2
&objectsPropertiesValues[16][ObjectsPropertiesValues][value][2]=value3
&Links[12][url]=http://www.example.com
&Links[13][url]=http://www.example1.com
* Mandatory data
format: format of returned data. It is used to immediately generate data for an object editing command PUT /objects/123. Possible values: api
Usage example
GET /objects/123
GET /objects/123?format=api
Endpoints
GET /properties: listing of properties, by pages;
POST /properties: creating new property;
GET /properties/123: information about property 123;
Usage example:
GET /properties?filter[name]=foo&lang=en
GET /properties?filter[name][like]=bar&lang=en&sort=name
POST /properties&name=foo&lang=en
Endpoints
GET /properties-categories: listing of properties categories, by pages;
POST /properties-categories: creating new category;
GET /properties-categories/123: information about category 123;
Usage example:
GET /properties-categories?filter[name]=foo&lang=en
GET /properties-categories?filter[name][like]=bar&lang=en&sort=name
POST /properties-categories&name=foo&lang=en
Endpoints
GET /units: listing of units, by pages;
POST /units: creating new unit;
GET /units/123: information about unit 123;
Usage example:
GET /units?filter[name]=foo&lang=en
GET /units?filter[name][like]=bar&lang=en&sort=-name
POST /units&name=foo&lang=en
GET /comparisons: listing of comparisons, by pages;
POST /comparisons: creating new comparison;
GET /comparisons/123: information about comparison 123;
PATCH /comparisons/123 or PUT /comparisons/123: updating comparison 123;
expand
sortings
sortings.property
objects
Usage example
GET /comparisons?expand=sortings.property,objects&filter[name][like]=Foobar&filter[lang]=en&sort=-id
name: comparison name;
lang: language, two-letter format (*);
descriptions: description;
comparisonsSortings[n][ComparisonsSortings][name]: data for each property, n - property ID, possible field values name:
comparisonsSortings[n][ComparisonsSortings][property_id] *: property ID
comparisonsSortings[n][ComparisonsSortings][order] *: sorting order (1-10)
comparisonsSortings[n][ComparisonsSortings][direction]: sorting direction (asc, desc)
For example:
POST /comparisons
?objects[][Objects][id]=123
&objects[][Objects][id]=456
&name=Foo bar
&lang=en
&comparisonsSortings[34][ComparisonsSortings][property_id]=34
&comparisonsSortings[34][ComparisonsSortings][order]=1
&comparisonsSortings[34][ComparisonsSortings][direction]=asc
&comparisonsSortings[35][ComparisonsSortings][property_id]=35
&comparisonsSortings[35][ComparisonsSortings][order]=1
&comparisonsSortings[35][ComparisonsSortings][direction]=desc
* Mandatory data