Social - Share

/social/share/{id}

An all inclusive share API call to handle all the other API calls in one.

GET - With an ID returns a single share share/get
GET - Without an ID does a share/search
POST - Create a share - does a share/add json ref Social - Share - Add - Referencebinary and then handles comms via share/add/comm share/remove/comm
PUT - Update a share - does a share/update json ref Social - Share - Update - Referencebinary and then handles comms via share/add/comm share/remove/comm
DELETE - Remove a share - does a share/remove

Passing data in the body details:
If JSON data:
 -if just share data in body, make sure to set the query arguments for title/desc/communitiyIds/type/etc and be certain to set extra query argument "data_type=json" this will let the API know to set the body to obj.share
 -if entire share object in body, no need to set query arguments, set data in obj.share field
If binary file data: set query arguments for title/desc/etc and make sure ?type=binary, make sure to set the mediatype of the incoming request as we use that to set the type of the binary file

 

Shares are just entries in our database where you can save any information you want.  Currently our application uses the shares to store things like query history (JSON), map reduce jars(BINARY), widget swfs (BINARY), among other things.  To create a share you can either call this call to add a JSON string entry or share/add/binary to insert a byte stream (such as a file).  Once you have added a share only you have access to it (via your personal community).  If you want others to have access to the share you can add their communities via share/add/community.

A simple web-based utility is available for performing many share management activities.

Authentication

Required, see Auth - Login

Arguments

id (optional)
Id of share to try and get/delete (only useful for those 2 calls)

Parameters

id (optional)
Id param of search

skip (optional)
Skip param of search

limit (optional)
limit param of search

searchby (optional)
searchby param of search

type (optional)
type param of search or type param for POST/PUT (usually reserved for submitting binary requests this way so the payload can be just the data)

title (optional)
title param for POST/PUT (usually reserved for submitting binary requests this way so the payload can be just the data)

description(optional)
description param for POST/PUT (usually reserved for submitting binary requests this way so the payload can be just the data)

communityIds(optional)
communities param for POST/PUT (usually reserved for submitting binary requests this way so the payload can be just the data), takes a comma separated list of commIds e.g. 12345, 23456 to set the comms for that source

ignoreAdmin(optional)
ignoreAdmin param of search

nocontent (optional)
nocontent param of get/search

filename(optional)
if you are getting the content of a binary share, will name the download what you pass in here (e.g. my_file.txt) GET only

nometa (optional)
nometa param of get

searchParent (optional)
searchParent param of search

readWrite (optional)
readWrite param of search

data_type (optional)
extra argument when set to type=json will read body of request as share data and set obj.share equal to that (see info section at top of page for reference)

Body

In the body/payload of a request you can send a share object, will pull out the necessary fields, e.g. can be used when sending a new JSON share on a POST request e.g. {"title":"new share","type":"test type", "description":"desc","share":"{\"data\":\"some data here\"}"}

Example

Method.GET - get
http://infinite.ikanow.com/api/social/share/get/53ff2cd5e230ed94d3a15975

Method.GET - search

http://infinite.ikanow.com/api/social/share?type=test1&filename=my_file.txt

Method.POST

Example using curl:

curl \-XPOST 'http://infinite.ikanow.com/api/social/share' \-d '{    "title":"t7",    "description":"nothin",    "type":"test1",    "communities":[{"_id":"53e638f8e4b0e2d48e35c92a"}],    "documentLocation":{"database":"doc_metadata","collection":"metadata","_id":"53d96f67e4b0ac9d0bec66be"}}'

A detailed example of adding a jar file to the share db and then accessing it to schedule a map reduce job in JAVA can be found here: Java Share Example

Method.PUT

curl \-XPUT 'http://infinite.ikanow.com/api/social/share' \-d '{    "_id": "53fcd218e2303160fd6b6d24",    "title":"t8",    "description":"nothin",    "type":"test1",    "communities":[{"_id":"53e638f8e4b0e2d48e35c92a"}],    "documentLocation":{"database":"doc_metadata","collection":"metadata","_id":"53d96f67e4b0ac9d0bec66be"}}'

Method.DELETE

curl \-XDELETE 'http://infinite.ikanow.com/api/social/share/53fcd218e2303160fd6b6d24'
Example Response
{
	response: {
		action: "New Share"
		success: true
		message: "New share added successfully."
		time: 10
	},
    data: "4e175bfeb8ed6403f48ea7e2"
 }