DocumentsControllerInsert Method |
[This is preliminary documentation and is subject to change.]
Adds a new document instance to the database. All required fields in the document should be filled out.
Don't forget the document type guid.
Namespace: WebServiceKit.ControllersAssembly: WebServiceKit (in WebServiceKit.dll) Version: 1.0.0.0 (1.0.0.0)
Syntaxpublic IHttpActionResult Insert(
QueuedObject _qo,
bool randomize = false
)
Public Function Insert (
_qo As QueuedObject,
Optional randomize As Boolean = false
) As IHttpActionResult
public:
IHttpActionResult^ Insert(
QueuedObject^ _qo,
bool randomize = false
)
member Insert :
_qo : QueuedObject *
?randomize : bool
(* Defaults:
let _randomize = defaultArg randomize false
*)
-> IHttpActionResult
Parameters
- _qo
- Type: QueuedObject
The serialized document data (pulled from the request body). - randomize (Optional)
- Type: SystemBoolean
True if the internal guids in the document instance should be randomized.
Return Value
Type:
IHttpActionResult200 OK if the document instance is inserted, otherwise 400.
Remarks
The document must be formatted using XML or JSON depending on the client PUT. Call requires a valid login token.
HTTP Method: PUT
[Route("api/documents/insert")]
Sample: api/documents/insert/<guid>
Sample: api/documents/insert/<guid>?randomize=true
Examples
Python:
(http://docs.python-requests.org/en/latest/)
baseUrl = 'http://webservices.mobileepiphany.com/api'
loginString = b'MyCompany:dev:dev:1234'
encodedLogin = base64.b64encode (loginString).decode("utf-8")
loginHeader = {'Authorization':'Login ' + encodedLogin}
loginUrl = baseUrl + '/login'
r = requests.get(loginUrl, headers=loginHeader)
r.raise_for_status()
loginToken = r.text.strip('"')
print('Login Token: ' + r.text)
tokenHeader = {'Authorization':'Token ' + loginToken, 'content-type': 'application/json'}
docTypeGuid = '95eb1b3d-8f03-4549-ad16-69ecbe92a65a'
docTemplateUrl = baseUrl + '/documenttemplate/' + docTypeGuid
r = requests.get(docTemplateUrl, headers=tokenHeader)
r.raise_for_status()
docTemplate = r.text
docInstanceUrl = baseUrl + '/documents/insert'
r = requests.put(docInstanceUrl, headers=tokenHeader, data=docTemplate)
r.raise_for_status()
See Also