Migrated from Redmine #1050 | Author: Marc Fielding
Status: New | Priority: High, I’m very impatient | Created: 2023-04-25
Hey Guys,
I’m trying to use addClient to as part of a custom signUp flow where we send a coupon code to new customers THEN add them to simply book.
error is
{
code: -32062,
message: 'Client email value is wrong',
data: { field: 'email' }
}
Calling code is:
axios.post( 'https://user-api.simplybook.me/admin',
{
jsonrpc: '2,0',
method: 'addClient',
params: {name: 'marc fielding', email: 'MY_VALID_EMAIL', phone:'XXXX'},
id: 1,
},
{
headers: {
'X-Company-Login': 'oasisthaimassage',
'X-User-Token': token.data,
'Content-Type': 'application/json',
}
}
)
.then(response => {
console.log(response.data)
if (response.data.error) {
console.log(response.data.error)
reject({
success: false,
data: response.data.error
})
} else if (response.data.result.errors) {
console.log(response.data.result.errors)
reject({
success: false,
data: response.data.result.errors
})
} else if (response.data.result) {
console.log(response.data.result)
resolve({
success: true,
data: response.data.result
})
}
})
.catch(err => {
reject({
success: false,
data: err
})
})
})
}
Any ideas?
Thanks
Marc