Quantcast
Channel: Appacitive » Blog
Viewing all articles
Browse latest Browse all 4

Searching on Appacitive. Part 2

$
0
0

Hey, welcome back ! In this tutorial we are gonna take a look at some of the more advanced searching techniques in the Appacitive API.

Article Search

I. The in-between query -
GET http://apis.appacitive.com/Article/SchemaB/find/all/{articleAId}/relationAB/labelAB/{articleCId}/relationBC/labelCB
{articleAId} is an article of SchemaA and {articleCId} is an article of SchemaC. This query would return articles of SchemaB that fulfill the given scenario. i.e. have connections to articles of SchemaA and SchemaC of type RelationAB and RelationBC respectively.

As a real world example, consider schemas hotels, visitors and reviews. Visitors visit hotels and some of them write reviews about their visits. SchemaA is hotels and SchemaC is visitirs. We want articles of reviews (SchemaB) where we provide the hotel and the visitor and their corresponding labels.

Connection Search

I. The find connections for articles query -
In this query you provide two articles of same or different schemas and all connections between those two articles are returned. Also if you optionally provide a `relatiotype` as a query string parameter with the name or id of a relation as its value, you will get back just the connections of that relation type between those two articles.

a. Connections of all relations
GET http://apis.appacitive.com/connection/SchemaB/find/{articleId1}/{articleId2}

b. Connections of a specefic relation
GET http://apis.appacitive.com/connection/SchemaB/find/{articleId1}/{articleId2}?relationtype={relation name or id}

II. The find connected articles query -
In this search, you provide a relation type (name or id) and an articleId and what is returned are two lists, one of all the connections belonging to the above mentioned relation whose one endpoint is the above mentioned article and also all the other article ids that are on the opposite end of these connections.
Such queries come helpful in a situation where you want to know all the interactions of a specefic kind for of a particular article in the system. For example if I want to know all the hotels a visitor has ever visited and also details of all the visits, I would use this query.
GET http://apis.appacitive.com/connection/{relation name or id}/{articleId}/find

III. The interconnects query -
This query is a POST call with its body containing two parts. The first part is a single article Id and the other part is a list of article Ids. What this query returns is a paginated list of all connections between the single article id and any of the article ids in the list. For example if you just wanted to know the visits of a visitor for a single chain of hotels, you would pass the visitor article id as the single article id and the hotel ids as the list of article ids.
POST http://apis.appacitive.com/connection/interconnects
{
“article1id”: “1″,
“article2ids”: [
"2",
"3",
"4"
]
}
This would return all connections with artcle id 1 on one side and 2,3 or 4 on the other side.

Graph Query 

This is one of the most powerful query features in the Appacitive API.
<coming soon>


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images