Web API, Upload target, Status code 500 answer
1. SDK Version: Web API
2. Development Environment: (eg. Unity-Android, Unity-iOS, Native Android, Native iOS): Web API (node js)
3. Tracker/Scanner: Web API
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise): Pro
5. Target Device(Optional): Web API
We are making a proxy web api, so the admins can create targets in the system's CMS. Making a create request as per: https://developer.maxst.com/MD/doc/5_0_x/cloud/webapi
The request returns status code 500 (Internal error). This is the responce we get from your server:
{"Error":{"Status":500,"Code":"E500","Message":"Value cannot be null.\r\nParameter name: model","Link":"","DeveloperMessage":""},"ModelValidResult":null,"Etc":null}
URL: https://developer.maxst.com/api/Trackables
METHOD: POST
HEADERS: Content-Type: application/json; charset=utf-8
Authorization: Token TOKEN_HERE (I suppose we would be getting 401 in case this one was wrong)
Body: RealWidth (float), Name (string), UploadFile (base64 string - this is the only one that I think we can get wrong, what does base64 format byte array stands for? We tried base64 string e.g.: "UploadFile":"/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD" , buffer e.g.: "UploadFile":[255,216,255,224,0] - nothing seems to work)
Thanks for your interest to our MAXST AR SDK.
Would you trying to upload an image with the Cloud Web API(Not Local Web API)?
The reason for uploading a base64 format image is used to prevent special characters or certain characters from being broken when encoded.
For more specific information reference to Base64 encoding and decoding page.
developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
Also, Were you add OriginalFileName and Custom parameter in body?
If you have other question, feel free to continues question us.
Thanks.
Francisco
MAXST Support Team
Would you trying to upload an image with the Cloud Web API(Not Local Web API)?
I'm not following you here ^. We used https://developer.maxst.com/MD/doc/5_0_x/cloud/webapi guide - it states Cloud Web API. Why do you think we use Local Web API?
We do not add OriginalFileName or Custom as they are marked as not mandatory.
We perfectly understand what Base64 encoding is. Could you provide a sample of JSON with valid UploadFile field please?
Please see the example below and check your Json Format.
Request body :
{
"Name":"sample",
"UploadFile":"iVBORw0KGgoAAAANSUhEUgAAA44AAAOOAgMAAAAymaQHAAAADFBMVEXm5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qiNzQvPDdUCu+5HsO5LOSUcS8rd8fQCZgqynEMjVQtZnBoKurlXkK8jVarVMLutCEpCH+klN8x+HrD4z8DwI+WQdHowY1JBbSUsmak9kJa0LGdSerYta/FJ7SjIKWfk1cBiFrDzIcxqFrPwa+DdqrdZarCaorAsJW+EzLT8xYK3WyiF3ypHZ+smVQ26WM0gWsnTlGbdpyFFxqi4L2eyXVvumIQuTA2/jkMu5ebyVh1w6KY/bPOR+ac41Dbk0mXXr0pDN5e2RtTDPc5S4R9bi/lGnmfvWLUy5Zu5AeOH6OmntJbmyyKtz2/Md76VufTr30+5d7ktRznfq3Qt+88vZP+xx9OttBv9/M74Of4fP4P7n15+G6S8qGv4YjbcxQUJ6rxYkJCQkJCQkJCQkJGRaqyU0Q0JCQkJCQkJCQkJqtYRmSEhISEhISEhISEhIrZaZAUhISEhISEhISEhIrZbQDAkJCQkJCQkJCQmp1RKaISEhISEhISEhISEhtVpmBiAhISEhISEhISEhtVpCMyQkJCQkJCQkJCSkVktohoSEhISEhISEhISE1GpBQkJCQkJCQkJCQkJqtYRmSEhISEhISEhISEitltAMCQkJCQkJCQkJCQmp1YKEhISEhISEhISEhNRqCc2QkJCQkJCQkJCQkFotoRkSEhISEhISEhISUqslNENCQkJCQkJCQkJCQmq1hGZISEhISEhISEhISK2W0AwJCQkJCQkJCQkJqdUSmiEhISEhISEhISEhIbVaQjMkJCQkJCQkJCQkpFZLaIaEhISEhISEhISE1GoJzZCQkJCQkJCQkJCQkFotMwOQkJCQkJCQkJCQkFotoRkSEhISEhISEhISUqslNENCQkJCQkJCQkJCQmq1zAxAQkJCQkJCQkJCQmq1hGZISEhISEjIX438Cgqn18g8UhclAAAAAElFTkSuQmCC",
"RealWidth":0.3
}
Thanks,
Ella
ok, made it work through postman, will figure out from there
Congraturation on solved problem.
Good Luck to your works.
ps. The meaning of the question above is as follows.
To solve the problem, I first checked if you are confused with Local Web API and Cloud Web API.
Francisco
MAXST Support Team
Tried the above mentioned sample request, got 500 error.
URL : https://developer.maxst.com/api/UN/Trackables
Verb : POST
{
"Error": {
"Status": 500,
"Code": "E500",
"Message": "An error occurred while updating the entries. See the inner exception for details.",
"Link": "",
"DeveloperMessage": ""
},
"ModelValidResult": null,
"Etc": null
}
Hello, santhosh
Thanks for your interest to our MAXST AR SDK.
At first, We are sorry to confused.
When posting an image, the key value of OriginalFileName must also be included,
but this seems to be caused by missing this from our localWeb API documentation.
When posting an image, please enter Name, UploadFile, RealWidth and OriginalFileName as key values.
Also, Please reference to bottom link.
https://developer.maxst.com/MD/doc/g/localwebapi
Best regards
Francisco
MAXST Support Team