I have tried several attempts to upload a GeoJSON FeatureSet to the Azure Map Service REST API.
https://learn.microsoft.com/en-us/rest/api/maps/data/uploadpreview
The JSON I tried came from http://geojson.xyz/ - namely the "populated places simple" file, which you can download here:
https://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_50m_populated_places_simple.geojson
1,249 points, 175KB.
On POSTing to /mapData/upload I get a HTTP 200, and 'success' response message.
The response headers includes a location, which when I query I get a 200 back, with this error message in the body.
{
"error": {
"code": "400 BadRequest",
"message":
"Upload request failed.\nYour data has been removed " +
"as we encountered the following problems with it:\n" +
"System.Threading.Tasks.Task`1[System.String[]]"
}
}
Any ideas?
Richard, I wasn't able to repro your issue.
The file is indeed a valid GeoJSON file and I was able to successfully upload the file ne_50m_populated_places_simple.geojson(Downloaded from http://geojson.xyz/) using the Map Data Service Upload API
Please give it another try and feel free to let us know if you still see any issues.
The team is investigating, but they say this is often due to issues with the GeoJSON file. Try pasting your GeoJSON into this site: http://geojson.io/ If you see any red in the side panel, hover over it and it should provide some insights into the issue.
Related
I am trying to create the upload PUT request for the OneDrive API. It's the large file "resumable upload" version which requires the createUploadSession.
I have read the Microsoft docs here: As a warning the docs are VERY inaccurate and full of factual errors...
The docs simply say:
PUT
https://sn3302.up.1drv.com/up/fe6987415ace7X4e1eF866337Content-Length:
26Content-Range: bytes 0-25/128 <bytes 0-25 of the
file>
I am authenticated and have the upload session created, however when I pass the JSON body containing my binary file I receive this error:
{ "error": {
"code": "BadRequest",
"message": "Property file in payload has a value that does not match schema.", .....
Can anyone point me at the schema definition? Or explain how the JSON should be constructed?
As a side question, am I right in using "application/json" for this at all? What format should the request use?
Just to confirm, I am able to see the temp file created ready and waiting on OneDrive for the upload, so I know I'm close.
Thanks for any help!
If you're uploading the entire file in a single request then why do you use upload session when you can use the simple PUT request?
url = https://graph.microsoft.com/v1.0/{user_id}/items/{parent_folder_ref_id}:/{filename}:/content
and "Content-Type": "text/plain" header and in body simply put the file bytes.
If for some reason I don't understand you have to use single-chunk upload session then:
Create upload session (you didn't specified any problems here so i'm not elaborating)
Get uploadUrl from createUploadSession response and send PUT request with the following headers:
2.1 "Content-Length": str(file_size_in_bytes)
2.2 "Content-Range": "bytes 0-{file_size_in_bytes - 1}/{file_size_in_bytes}"
2.3 "Content-Type": "text/plain"
Pass the file bytes in body.
Note that in the PUT request the body is not json but simply bytes (as specified by the content-type header.
Also note that max chuck size is 4MB so if your file is larger than that, you will have to split into more than one chunks.
Goodlcuk
I'm working on generation of Google Presentation and sometimes batchUpdate throws the error:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
Here's the example of the request body
Issue:
Your request body is huge. You are requesting many updates in the presentation with a single call. Since you are getting a 500 error, the server is most likely having problems while processing this huge amount of requests.
It's certainly not a question of write request limits, since you are only making one single (large) write request (and HTTP status is not the appropriate one either).
Solution:
In any case, I would suggest you to split your call into as many parts as necessary so that you never get this error. Group the requests into different request bodies and call batchUpdate several successive times. This should fix your problem.
Reference:
presentations.batchUpdate
Slides API: Usage Limits
500 Internal Server Error
Looking to send an HTTP POST through Microsoft Flow/Power Automate to make a voice call in Twilio. I feel like I've tried every iteration possible, but keep getting the error 21201:
{
"code": 21201,
"message": "No 'To' number is specified",
"more_info": "https://www.twilio.com/docs/errors/21201",
"status": 400
}
Screenshot of Power Automate HTTP Action
I've seen other vids of people using Azure Functions with C# and it feels like I should be able to do what I need here...like, really close. But I'm not a dev, so maybe I'm way off. Would appreciate any direction on this.
Thanks!
The issue appears to be you are sending a content type of application/json where Twilio requires application/x-www-form-urlencoded
Creating or Updating Resources with the HTTP POST and PUT Methods
Also found this:
Custom connector action with x-www-form-urlencoded content-type
I have tried to send files using multipart form data, but all I get is the following error:
{"description":"Error: Bad Request: chat_id is empty","error_code":400,"ok":false}
Here is my code snippet. Can anyone help me out where I am committing an error?
public HttpResponse<jsonnode> sendDocument(Integer chat_id,File f1) throws UnirestException {
return Unirest.post(endpoint + token + "/sendDocument")
header("accept", "application/json")
.field("chat_id", chat_id)
.field("document", f1)
.asJson();
}
well, it said chat_id is empty. that's an obvious error!
but for your question, there is only two ways to sendDocument to telegram.
that file is already is in their servers, so you should just pass the file_id in "document" field
you want to upload a file from your device and as they said
Must be posted using multipart/form-data in the usual way that files are uploaded via the browser
if you are doing the upload section correct, then just make sure chat_id is not empty.
I'm trying out http requests to download a pdf file from google docs using google document list API and OAuth 1.0. I'm not using any external api for oauth or google docs.
Following the documentation, I obtained download URL for the pdf which works fine when placed in a browser.
According to documentation I should send a request that looks like this:
GET https://doc-04-20-docs.googleusercontent.com/docs/secure/m7an0emtau/WJm12345/YzI2Y2ExYWVm?h=16655626&e=download&gd=true
However, the download URL has something funny going on with the paremeters, it looks like this:
https://doc-00-00-docs.googleusercontent.com/docs/securesc/5ud8e...tMzQ?h=15287211447292764666&\;e=download&\;gd=true
(in the url '&\;' is actually without '\' but I put it here in the post to avoid escaping it as '&').
So what is the case here; do I have 3 parameters h,e,gd or do I have one parameter h with value 15287211447292764666&ae=download&gd=true, or maybe I have the following 3 param-value pairs: h = 15287211447292764666, amp;e = download, amp;gd = true (which I think is the case and it seems like a bug)?
In order to form a proper http request I need to know exectly what are the parameters names and values, however the download URL I have is confusing. Moreover, if the params names are h,amp;e and amp;gd, is the request containing those params valid for obtaining file content (if not it seems like a bug).
I didn't have problems downloading and uploading documents (msword docs) and my scope for downloading a file is correct.
I experimented with different requests a lot. When I treat the 3 parameters (h,e,gd) separetaly I get Unauthorized 401. If I assume that I have only one parameter - h with value 15287211447292764666&ae=download&gd=true I get 500 Internal Server Error (google api states: 'An unexpected error has occurred in the API.','If the problem persists, please post in the forum.').
If I don't put any paremeters at all or I put 3 parameters -h,amp;e,amp;gd, I get 302 Found. I tried following the redirections sending more requests but I still couldn't get the actual pdf content. I also experimented in OAuth Playground and it seems it's not working as it's supposed to neither. Sending get request in OAuth with the download URL responds with 302 Found instead of responding with the PDF content.
What is going on here? How can I obtain the pdf content in a response? Please help.
I have experimented same issue with oAuth2 (error 401).
Solved by inserting the oAuth2 token in request header and not in URL.
I have replaced &access_token=<token> in the URL by setRequestHeader("Authorization", "Bearer <token>" )