简体   繁体   中英

Bad Request error: 400 in React js using axios put

i am working with react js in a dashboard, but when I try to do a PUT request, the response is error 400 or 401, the message is:

{"code":"missing_params","message":"Your update call does not have any parameter. At least one parameter is required."}

But, I added the params to the request, I do not understand what i'm doing wrong?

update() {

    var url="https://icgaid.freshdesk.com/api/v2/tickets/65"

    axios(url,{method:'put',headers: { 'authorization':'Basic ZHBhbG1hQGljZy5jb20uZ3Q6Z3VhdGU1MDI==','Content-Type':'application/json'},body:{'status':4}})
      .then(response => response.json())
      .then(json => {console.log(json);this.setState({re:json})})
}

The object should have a member called data, you have body, also you should check the API documentation, maybe you have a typo, the parameters names could be wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM