0

I use the API of a online service to send the email of a client that just made an order from my eshop. I do this using fetch in javascript. What i want you to help me with is how to iclude the variable, that has as value the email of the client, to the body of my request. The variable is newClientMail and the body of the request is body: '{"email": }'.
body: '{"email": newClientMail}' if i write it that way i get an internal server error status 500.


let newClientMail = clientEmail.replace('/', '');

fetch('https://useapi.useinbox.com/inbox/v1/contactlists/61b212ba8813690001cd5228/add', {
        method: 'POST', 
        headers: {'Content-Type': 'application/json',
                   'Authorization': 'Bearer ' + authToken},
        body: '{"email": }'                                                            
        })
        })
        .then(function (response) {
        return response.json(); 
         })
        .then(function (data) {
         console.log(data);
        })

Ulysses
  • 23
  • 5

0 Answers0