[Solve front-end error reporting] Bad Request: Required request parameter 'id' for method parameter type Long is not present

The object returned by the back-end query list interface contains a Long id, and the front-end obtains this id, and executes the delete operation through the Long id. At this time, the delete operation reports an error 400, to the effect that the id of the Long type is not found.

Screenshot of swagger-related interfaces:
insert image description here
The Long type displayed in swagger is integer64, and integer is integer32.
insert image description here
This is the error message that appears in my backend console console after the front-end request.
The front-end part of the code is shown in the figure below:
insert image description here
Maybe the problem occurs in the parameter passing of the interface. Is the received parameter in urlencode encoding format or json encoding format?

At this time, I suddenly realized that maybe after the front end obtained a piece of data, it did not convert the corresponding field value type into json format when obtaining a certain field value of this data, but as an interface, it only recognizes the input jsonformat ginseng. This leads to the above error, no required value exists.
For example, if a piece of data of Usertype , the is Long Idtaken out separately as an input parameter and passed to the interface. At this time, it needs to be Long Idconverted into Json format. It has to json.Stringfy(id)be passed in in string format to convert it to json.

guide this packageinsert image description here

The front end can try to qs.stringfiyre json.Stringfy()-encode the parameters with .

Related Links 1
Related Links 2
Related Links 3

Guess you like

Origin blog.csdn.net/qq_45486709/article/details/123977934