Request Parameters:


Upload file in nopCommerce


URL: ../Api/Client/UploadFile


Header:

Content-Type:application/json


Case-1. Success Response :

Parameter:

{
    "ApiSecretKey": "i99b98d117m116a112o98k115c111",
    "FileBytes": [100,2,65,8],
    "FileContentType": "image/png",
    "FileName": "RestAPIFileUpload",
    "FileExtension": ".png"
}

Response:
 {
    "Status": 1,
    "Message": "File uploaded successfully.",
    "Data": {
        "DownloadGuid": "5067bf7e-fb6c-4979-96e0-c290510d1ccf",
        "UseDownloadUrl": false,
        "DownloadUrl": "",
        "DownloadBinary": "ZAJBCA==",
        "ContentType": "image/png",
        "Filename": "RestAPIFileUpload",
        "Extension": ".png",
        "IsNew": true,
        "Id": 2013
    },
    "ValidationMessage": [],
    "ErrorMessage": null
}


Case-2. Incorrect parameters :

Parameter:

{
    "ApiSecretKey": "i99b98d117m116a112o98k115c111",
    "FileBytes": [100,2,65,8],
    "FileContentType": "",
    "FileName": "RestAPIFileUpload",
    "FileExtension": ".png"
}

Response:
{
    "Status": 2,
    "Message": "Invalid parameters.",
    "Data": null,
    "ValidationMessage": [
        "The FileContentType field is required."
    ],
    "ErrorMessage": null
}