JSON API » files » files/create

Creates a new file.

Input parameters

Requires authentication and the files role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
dataBase64Base64 encoded contents of file.Yes
nameStringName.Yes
customerIntegerID of customer to create in.NoCustomer of authentication user.
descriptionStringDescription.NoEmpty string.
filenameStringAn optional file name.NoEmpty string.
mimetypeStringAn optional mimetype.NoEmpty string.
publicInteger1 to make publicly available, 0 not to.No0
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.

Data returned

The ID of the created file.

Example: With required parameters (data not shown for brevity)

http://enswitch.example.com/api/json/files/create/?auth_username=user;auth_password=password;name=example1.css;data=...

{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }

Change history

VersionChanges
4.0Function added.