Calling Image.json Getting Error: Maximum upload size of 8M exceeded

panthers1788panthers1788 Member Posts: 6

The image I am trying to upload is well under 8M, it is like 400KB. What does this exactly mean, and how can it be fixed.

8 comments

  • panthers1788panthers1788 Member Posts: 6

    I thought it may be a timing that my as I was doing alot of testing but I waited about 8 hours, got refresh tokens, and even tried getting new authorization code but still the same error. Why this type of error wouldn't be explained in the documentation is amazing to me because it makes no sense at all.

  • LeahLeah Moderator, Lightspeed Staff Posts: 119 moderator

    Hi @panthers1788 can you post the payload you're sending so I can see if I can find the reason for the error? Thanks.

    API Support
    Lightspeed HQ
  • panthers1788panthers1788 Member Posts: 6
    https://us.v-cdn.net/6025193/uploads/813/NN5KXMV0P9B0.txt There was an error displaying this embed.

    I have attached a text document of the request from fiddler. When I compare it to the request that is made when you manually upload an image using the application it is the same (other than I am using JSON and the appication uses XML - I tried using XML but got the same results), as well as at the very bottom of the document the response I get.

  • LeahLeah Moderator, Lightspeed Staff Posts: 119 moderator
    edited November 5

    Hi @panthers1788, I think the issue in this case is that the query is malformed. There is a missing double quote on the itemID field:

    -----------------------------7e3336276305ae

    Content-Disposition: form-data; name="data"

    {"description": "Test","ordering": "0","itemID": 2309","filename":"Test.PNG"}

    -----------------------------7e3336276305ae

    Content-Disposition: form-data; name="image"; filename="C:\d3logo.png"

    Content-Type: image/png

    That error message will be displayed not only when the image size is too large, but also when no image data is being sent to the endpoint. This issue has already been reported in order to have the error message changed to something that is correct and clear such as 'no data input' or similar.

    API Support
    Lightspeed HQ
  • panthers1788panthers1788 Member Posts: 6

    Leah,

    Updated the code to fix the missing " but still am receiving the same error message. Please help ASAP.


    Attached is the new payload.

    https://us.v-cdn.net/6025193/uploads/422/WK4YGYYC14BO.txt There was an error displaying this embed.


  • LeahLeah Moderator, Lightspeed Staff Posts: 119 moderator

    Everything here looks fine:

    -----------------------------7e3336276305ae

    Content-Disposition: form-data; name="data"

    {"description": "Test","ordering": "0","itemID": "2309","filename":"Test.PNG"}

    -----------------------------7e3336276305ae

    Content-Disposition: form-data; name="image"; filename="C:\d3logo.png"

    Content-Type: image/png


    I would suggest that the software you're using is not attaching/sending the file correctly, since the API is essentially telling you that you're sending an empty POST.

    API Support
    Lightspeed HQ
  • panthers1788panthers1788 Member Posts: 6

    Isn't the API telling me that I am sending a file too large, not an empty post???

  • LeahLeah Moderator, Lightspeed Staff Posts: 119 moderator

    Right, but as I mentioned previously: That error message will be displayed not only when the image size is too large, but also when no image data is being sent to the endpoint. Since you've mentioned that the filesize is not over 8MB, and the payload looks correct, I am deducing that the file is not actually being sent with that request, hence generating that error. Our developers are aware that the error message is incorrect when an empty POST request is sent to the Image endpoint, and this will be rectified. In the meantime, I can assure you that I am able to upload images using that endpoint with both cURL and postman, and suggest you verify the settings your application to make sure the file is indeed being attached to the request.

    API Support
    Lightspeed HQ
Sign In or Register to comment.