I am trying to build a connection to Front to interact with the conversations, so we can assign the assignees to the conversations through the API. Using the example of the API documentation keeps giving me errors and I can’t figure out what is going wrong. I’m using the Update conversation assignee with the NodeJS example, but I keep getting an error: {"_error":{"status":400,"title":"Bad request","message":"Body did not satisfy requirements","details":["body.assignee_id: missing"]}}
I’ve tried it with JSON and FormData, but the error stays the same, my latest example code is the following
// The endpoint returns an HTTP 204 on success (no content) // @see https://dev.frontapp.com/reference/update-conversation-assignee return { success: response.ok() } } catch (error) { console.error(err); } };
// So you would call this following, and result would be {success: true} or {success: false} const result = await frontUpdateAssignee({ conversation: "cnv_123", assignee_id: "tea_123", token: "MY_API_TOKEN", })
Looks like you’re sending a JSON payload, but sending a default multipart/form-data request by not specifying a Content-Type, so Front is not parsing the request body as JSON.
To resolve, just add a Content-Type: “application/json” header. You also probably want to remove or edit the Accept header, and Front will never return a multipart/form-data response body.
Hey, yeah sorry. Just changed this one to reflect my JSON one instead of my multipart/form-data one. Changed it to Content-Type: “application/json”, but sadly it made no change.
// The endpoint returns an HTTP 204 on success (no content) // @see https://dev.frontapp.com/reference/update-conversation-assignee return { success: response.ok() } } catch (error) { console.error(err); } };
// So you would call this following, and result would be {success: true} or {success: false} const result = await frontUpdateAssignee({ conversation: "cnv_123", assignee_id: "tea_123", token: "MY_API_TOKEN", })