I have a problem with sending files to some API. When I do it via my server some pdf files send correctly but some not. But when I send the same pdf via POSTMAN everything works just fine. I am not sure what is the reason (probably POSTMAN encodes it into base64 but from my server, I send it in binary - just a guess). Is there a way to get the sent request file content from postman so that I can imitate it and compare with the request on my server?
Related
I have python code wrote here: https://repl.it/#AndreiCiobnic/MixedWealthyGnuassembler
I'm trying to (re)write in Postman to make a POST request to that url.
I put like:
But I got error response from that server.
How to send the data json in Postman ?
Was trying to upload docx files through a golang server using MS graph API, and although I was able to upload pdfs, when I tried uploading docx files the files were being corrupted when sent over. If I upload the same file through the OneDrive website, there would be no problems.
To isolate the issue I tried making the API calls through postman using a link like:
https://graph.microsoft.com/v1.0/users/pqv2-dev-svc#novacoast.com/drives/{drive-id}/items/{item-id}:/filename.docx:/content
used a bearer token.
the additional header of Content-Type of which I have tried the values:
text/plain
application/x-www-form-urlencoded
application/vnd.openxmlformats-officedocument.wordprocessingml.document
and uploaded the file with the form-data option under the body tab but with no luck, the file always gets corrupted.
Any ideas?
[Resolved] Was sending file as form-data instead of binary!
I am kinda newby in python thus the question.
I am trying to create a simple http web server that can receive chunked data from a post request.
I have realized later that once a request sends a headers with chunked data, the Content-length headers will be set to zero, thus reading the sent data with 'request.get_data()' will fail.
Is there another way of reading the chunked data?
The request I receive does give me the data length in the 'X-Data-Length' headers.
Did you write both of the js upload file code and the flask in backend to handle upload request? If not then you will need some help with js to upload it.
One way to achieve chucked data upload is:
Chucked that file in the frontend with js. Give it some headers in the request for the total size, number of the chunk, chunk size... and send each chuck in a separate POST request (You can use dropzone.js for example, they will do the job for you, just need to config the params)
In the backend, create an upload API which will read the request headers and merge the file chunks back together
I'm connecting to SkyBiomtery API in my C++ code using CPPREST SDK (Casablanca).
The SkyBiometry API accepts both GET, POST requests. I need to send the image to the SkyBiometry could service. Either I save the image on some public server and send them the URL of the image in the request.
OR (Which is my question) They say that "Note: in case where you want to POST images instead of specifying urls, request to the method must be formed as a MIME multi-part message sent using POST data. Each argument should be specified as a separate chunk of form data."
How can I send the image data in POST request using the CPP Rest SDK?
I am sending get httpwebrequests to the facebook graph api and all was working fine till I deployed to production server and now module that expects html/xml response is not working and when tested url in internet explorer, the save file dialog pops up and the file needs to be saved.
Other modules also send requests to the facebook graph but just differ in the form of requests so not sure what is going on here.
Any ideas appreciated
Edit:
Let me try and rephrase this. On my production server the httpwebrequest was not returning the correct result. So to Test it I copied the url http://graph.facebook.com/pepsi which is an example, should return the profile info viewable in the browser. The server has internet explorer v8 and I am not sure why it tries to download the file instead of displaying it in the browser. this is what is happening in my code and when I make a request to a different part of the api, then it works in my app but not in the browser
Your question is not very clear. From what I gather, you want the display the JSON response in a browser. Instead, you are being asked to download a file by the browser.
Well, this is normal behaviour. The response you get from Facebook would most likely have a MIME type of application/json. Most newer web browsers display the text in the browser itself. Some browsers, however don't know how to handle this content type and just ask you to download the file.
You mentioned that your module expects an html/xml response. Try changing this to application/json.
You also said that it works in your app but not in your browser. I don't know what you're making, but generally you wouldn't show raw json to the user in a browser, right?