Getting 400 for the MSOneDrive Update rest api - javascript

I was trying to send request to update the file. Below is the request I am sending
But I am getting 400 bad request. Could anyone please let me know where I am going wrong?

Related

access response data from POST request after http status code 202 is received

I am facing into an issue, I need to make an POST request on api, which returns me 202 status code, and empty array, which means request is accepted, but I need to wait until data are populated. Need to mention that response doesn't have any location header, on the browser it works perfectly, button clicked, api called, returns 202, and wait for json data to "download".
So somehow I need to get response data not when response received but when request is finished!
I have searched a lot on the internet for any npm package that can solve this part, but unfortunately no luck. Does anyone have any idea if it can be solved with axios or any other node.js package
I tried to solve it using axios,https, fetch, but it returns 202 empty json response.
I also tried using responseType as 'stream' , 'blob'. It doesn't work.

400 Bad Request | Check Request size on client side before making API call?

I'm looking to add a JavaScript validation on client side before making a GET request to prevent the following 400 Bad Request error from happening, and show a custom message instead.
Example request URL would be as below:
/api/v1.0/example/?sample_query=Lorem%20Ipsum%20is%20simply%20dummy%20text%20of%20the%20printing%20and%20typesetting%20industry.%20Lorem%20Ipsum%20has%20been%20the%20industry%27s%20standard%20dummy%20text%20ever%20since%20the%201500s%2C%20when%20an%20unknown%20printer%20took%20a%20galley%20of%20type%20and%20scrambled%20it%20to%20make%20a%20type%20specimen%20book.%20It%20has%20survived%20not%20only%20five%20centuries%2C%20but%20also%20the%20leap%20into%20electronic%20typesetting%2C%20remaining%20essentially%20unchanged.%20It%20was%20popularised%20in%20the%201960s%20with%20the%20release%20of%20Letraset%20sheets%20containing%20Lorem%20Ipsum%20passages%2C%20and%20more%20recently%20with%20desktop%20publishing%20software%20like%20Aldus%20PageMaker%20including%20versions%20of%20Lorem%20Ipsum.%20%20Why%20do%20we%20use%20it%3F%20It%20is%20a%20long%20established%20fact%20that%20a%20reader%20will%20be%20distracted%20by%20the%20readable%20content%20of%20a%20page%20when%20looking%20at%20its%20layout.%20The%20point%20of%20using%20Lorem%20Ipsum%20is%20that%20it%20has%20a%20more-or-less%20normal%20distribution%20of%20letters%2C%20as%20opposed%20to%20using%20%27Content%20here%2C%20content%20here%27%2C%20making%20it%20look%20like%20readable%20English.%20Many%20desktop%20publishing%20packages%20and%20web%20page%20editors%20now%20use%20Lorem%20Ipsum%20as%20their%20default%20model%20text%2C%20and%20a%20search%20for%20%27lorem%20ipsum%27%20will%20uncover%20many%20web%20sites%20still%20in%20their%20infancy.%20Various%20versions%20have%20evolved%20over%20the%20years%2C%20sometimes%20by%20accident%2C%20sometimes%20on%20purpose%20(injected%20humour%20and%20the%20like).%20%20%20Where%20does%20it%20come%20from%3F%20Contrary%20to%20popular%20belief%2C%20Lorem%20Ipsum%20is%20not%20simply%20random%20text.%20It%20has%20roots%20in%20a%20piece%20of%20classical%20Latin%20literature%20from%2045%20BC%2C%20making%20it%20over%202000%20years%20old.%20Richard%20McClintock%2C%20a%20Latin%20professor%20at%20Hampden-Sydney%20College%20in%20Virginia%2C%20looked%20up%20one%20of%20the%20more%20obscure%20Latin%20words%2C%20consectetur%2C%20from%20a%20Lorem%20Ipsum%20passage%2C%20and%20going%20through%20the%20cites%20of%20the%20word%20in%20classical%20literature%2C%20discovered%20the%20undoubtable%20source.%20Lorem%20Ipsum%20comes%20from%20sections%201.10.32%20and%201.10.33%20of%20%22de%20Finibus%20Bonorum%20et%20Malorum%22%20(The%20Extremes%20of%20Good%20and%20Evil)%20by%20Cicero%2C%20written%20in%2045%20BC.%20This%20book%20is%20a%20treatise%20on%20the%20theory%20of%20ethics%2C%20very%20popular%20during%20the%20Renaissance.%20The%20first%20line%20of%20Lorem%20Ipsum%2C%20%22Lorem%20ipsum%20dolor%20sit%20amet..%22%2C%20comes%20from%20a%20line%20in%20section%201.10.32.%20%20The%20standard%20chunk%20of%20Lorem%20Ipsum%20used%20since%20the%201500s%20is%20reproduced%20below%20for%20those%20interested.%20Sections%201.10.32%20and%201.10.33%20from%20%22de%20Finibus%20Bonorum%20et%20Malorum%22%20by%20Cicero%20are%20also%20reproduced%20in%20their%20exact%20original%20form%2C%20accompanied%20by%20English%20versions%20from%20the%201914%20translation%20by%20H.%20Rackham.%20%20Where%20can%20I%20get%20some%3F%20There%20are%20many%20variations%20of%20passages%20of%20Lorem%20Ipsum%20available%2C%20but%20the%20majority%20have%20suffered%20alteration%20in%20some%20form%2C%20by%20injected%20humour%2C%20or%20randomised%20words%20which%20don%27t%20look%20even%20slightly%20believable.%20If%20you%20are%20going%20to%20use%20a%20passage%20of%20Lorem%20Ipsum%2C%20you%20need%20to%20be%20sure%20there%20isn%27t%20anything%20embarrassing%20hidden%20in%20the%20middle%20of%20text.%20All%20the%20Lorem%20Ipsum%20generators%20on%20the%20Internet%20tend%20to%20repeat%20predefined%20chunks%20as%20necessary%2C%20making%20this%20the%20first%20true%20generator%20on%20the%20Internet.%20It%20uses%20a%20dictionary%20of%20over%20200%20Latin%20words%2C%20combined%20with%20a%20handful%20of%20model%20sentence%20structures%2C%20to%20generate%20Lorem%20Ipsum%20which%20looks%20reasonable.&page=1&page_size=20
What is the proper way to validate the length of the whole request line? I only have the length of Request URL.

im getting a bad request 400 when I try to send some registration information to the server Cannot deserialize instance of out of START_ARRAY token

im still learning how to do this, and its my first time of full stack, im getting a an error 400 bad request when I try to parse json to the server and I don't know why, can you help me understand
my javascript code trying to communicate with server
400 bad request error on the console when I click register button
You might need to serialize the body data you are sending to the server with json stringify or another tool per web standards. Posting your server logic might help too.
here is the fetch documentation to stringify json before sending to the server to be read: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

Handling get response while server has been crashed

I have a question.
I send a Get request by Ajax every second and expect to get some response from the server.
In the case and my application crashes and I continue to send Get request every second, I don't get any response until receiving the server's timeout error (an error code 502.) .
If somebody knows how I can handle this moment between sending the get requests every second and until receiving error code 502.
Thanks
If the server is down, whatever you are using for the ajax call should have errored out... in which case you should handle it with a call back or a catch block. There, you should handle what you will do on the frontend based on the response.
As far as not sending out more requests, there really is no way to know for sure. For all your code knows, the server is particularly slow at that moment.

Cant get the user openclinica apiKey

This is the Endpoint for getting user account and its Api Key:
https://dev.openclinica.com/apidoc/#api-User_Account-getAccountByUserName
using the folling endpoint with postman
POST http://89.221.253.174:8080/OpenClinica/pages/accounts/login?username=pranv&password=XXXX
I am getting 500 Internal Server Error and I dont know why.
I am not even quite sure if the URL is correct on my Postman.
Any help on this?
The url should be:
POST http://89.221.253.174:8080/OpenClinica/j_spring_security_check?username=pranv&password=XXXX
pages/accounts/login submits to j_spring_security_check

Categories

Resources