2

I am trying to send anonymous Zendesk ticket on React Native app using fetch:

export const sendZendeskTicket = async (description, email, name) => {
    let body = {
        "request": {
            "requester":
                {
                    "email": email,
                    "name": name
                },
            "subject": "some test subject",
            "comment":
                {
                    "body": description
                }
        }
    }

    console.log(body)

    let request = await fetch(`https://*some_domain*.zendesk.com/api/v2/requests`, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify(body)
    })

    let response = await request.json()
    console.log(JSON.stringify(response))
    return response.ok
}

My request body is:

{"request": {"comment": {"body": "some problem"}, "requester": {"email": "asdasdasd@asdasd.fff", "name": "Testss Userss"}, "subject": "some subject"}}

But I am getting

{"error":"RecordInvalid","description":"Record validation errors","details":{"base":[{"description":"Email: cannot be blank","error":"BlankValue","field_key":360013402611}]}}

I also tryed to call /api/v2/requests.json, but same result.

Anton A.
  • 1,718
  • 15
  • 37

0 Answers0