...
/config/source/test?numReturn=<documents-to-return>&returnFullText=<1|0|true|false> (POST)
Info |
---|
Adds a new, or updates an existing, source via either post or get methods. |
Authentication
Required, see Auth - Login
Arguments
communityId (required)
Group ID you want to associate this source with
json (required)
Source object in its JSON representation... (note to see Source documentation)
Examples
Method.Get
http://infinite.ikanow.com/api/config/source/save/communityid?json={}
Method.Post
Example using curl:
Code Block |
---|
curl -XPOST 'http://infinite.ikanow.com/api/config/source/save/communityid' -d '{ "json": {...} }' |
Actionscript
See this example.
Example Response
Info |
---|
Code Block |
---|
{
response: {
action: "Source"
success: true
message: "New source added successfully."
time: 10
}
}
|
Code Block |
---|
{
response: {
action: "Source"
success: true
message: "New source added successfully. Note functionally identical sources are also present within your communities, which may waste system resources."
time: 10
}
data: {
// source JSON, including the generated communityIds, key, and _id fields.
}
}
|
In this case above, the exact same source (only differing by "display" parameters, owner etc) already exists. It is recommended to delete the source unless you have a specific reason not to. Code Block |
---|
{
response: {
action: "Source"
success: true
message: "Source updated successfully."
time: 10
}
}
|
|
Error Response
Info |
---|
Code Block |
---|
{
response: {
action: "Source"
success: False
message: "Unable to add new source."
time: 10
}
}
|
Code Block |
---|
{
response: {
action: "Source"
success: False
message: "Unable to update source."
time: 10
}
}
|
Common error messages:- Unable to serialize Source JSON: indicates that the JSON object POSTED (or passed via URL parameter) is invalid. Try using JSON Lint or a similar tool to debug.
- The source ID is invalid: For update requests, a source "_id" or "key" has been specified that does not match any in the database (this often happens with adding a source where the "_id" or "key" from a different system has been left in).
- User does not have permissions to edit sources shared by this community: You are not the owner of this source, nor a community moderator, not a system admin.
- (curl/wget returns nothing: Normally an indication that a POST has been used with no URL parameter, or a POST has been used with no content.)
|