Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 12 months ago. Improve this question What is the best practice of returning when calling an API endpoint? Is it best to return the whole response? Let’s
Tag: rest
How to Type a request parameter with express server
How do I Type (typescript) the attached post request to fix the error? I want to get the request body, but I can’t type it properly. Thanks! this is only concerning the /exercises route which throws error with eslint plugin on vscode Answer You will want to define an interface for your request: By then casting your req.body to an
I’m trying to use Javascript Fetch rest API in spring boot project by catogeryId
Hi im trying to get rest api data on html page by javascript fetch but i cant be able to fetch url categoryId can anyone help me out. Ill be so thank full of them.this is my Html page where i fetching my data This is my rest controller from where i m getting my data Answer As im already
Keep getting a DELETE 400 (Bad Request) with my REST API
So, I’ve created a API and I’ve got my POST and GET requests working, but I’m can’t get the DELETE request to work. I keep getting a ‘DELETE http://localhost:3000/api 400 (Bad Request)’ error in the console. Here is the delete section in my server file: Here is the button that executes the DELETE: It says that the bad request comes
How to perform certain action when a post is created in Strapi CMS?
I am using Strapi CMS for my data handling with a NoSQL database. So, what I am trying to do is to publish the blog on Medium also when I publish it on Strapi CMS. I have all the credentials for publishing it on medium using API. So, the question is how to achieve this, how to perform a certain
Handling Mongoose Query Errors in Express.js
So let’s say I want to make a Mongoose query to a database, inside of an Express post route: My concern is the handleError function. I’m not quite sure what kind of errors could even happen in Mongoose since it’s just a simple query, but what should be included in the handleError function? And what response should I send to
Propper way of Error handling in a nodejs API server
I need to handle errors in my API server on node.js. I created a error handling module, which sends the errors (only in dev mode) to the API client in a JSON object similar to this: now the problem I have is, that I need to create a new error in a submodule of my API controller when no case
AWS S3 REST API “RequestTimeTooSkewed” Error
I am attempting to initiate a multipart upload to an s3 bucket directly from the browser by following the corresponding AWS Docs. However, I’m receiving the following response error: Am I mistaken or are these times in fact within the 9000 millisecond skew cap in which AWS deems a request time valid? After console logging the times for better analysis
Problem with fetching data from Spring Boot API endpoint using Java Script
I work on web application and encountered an issue with fetching data from an endpoint using Java Script. If I type endpoint adres in a browser it works perfectly fine but somehow it does not work in the script. The response.ok is returns False. Here is script: Here is controller: Here is service: What is wrong? If You have any
Separating Django REST back from Front end
This is a bit of a different question. I’ve tried researching the information for a few hours now and I can’t seem to find what I am looking for. I have a Django REST backend that I set up. Its very simple REST API that has one Model Model.py I’m able to post to via the REST api interface see