Also known as
  • Add other possible names for this topic

 

Name   upload
Description   Raw upload service, mainly for XHR based requests or requests from non-browser clients
Accessible Via   /api/service/upload
HTTP GET   No
HTTP POST   Yes
Special Headers   X-Metaweb-Request : any alnum value
Login Required   Yes
Required Arguments   file : file uploaded as part of request body
Optional Arguments   content_type : valid IANA mime-type per RFC2045 section 5.1

use_permission_of : type id/guid for object whose permission is the same as the desired permission on uploaded object


document : type id/guid of an existing document to which this content object is linked to

Extra Arguments Ignored   Yes
Response Format   application/json
Notes   Rules :
  1. If the document argument is not provided a new one is created
  2. If content-type argument is not provided, the service looks for the HTTP Content-Type header to get the information
  3. If the content-type argument and the HTTP Content-Type header are both provided the form argument takes precedence
  4. HTTP Content-Length header is mandatory.

The service also creates and executes a MQL query to register the content object in the graph and associate it with an existing document or newly created document as the case may be. 

Sample Response :

 {
"status": "200 OK",
"result": {
"length": $length$,
"blob_id": "d3e382ebdc06c41ab93b0d25adf132ff787f2cb511e792ed3d9807d44c56a680",
"language": "/lang/en",
"media_type": "text/plain",
"text_encoding": "utf-8",
"type": "/type/content",
"id": "/guid/4401a8c040004da3800000000002b1a7"
}
}
For additional information on using the callback parameter to generate a JSONP response, or using onsucceed and onfail to redirect to a URI template, see Common API Query Parameters.

With the exception of Wikipedia summaries and some images the content on this page is typically distributed under the Creative Commons Attribution license or Public Domain.

Topic History

Created by skud Dec 17, 2007
Last edited by philg Jul 30, 2008
Gallery add an image edit gallery
There are no images for this topic yet.

Recent Discussions about api/service/upload

There are no conversations on this topic. Would you like to start one?

Start the Discussion