Advertisement
RyanFarley

Untitled

Sep 24th, 2020 (edited)
1,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const createContactByEmail = (sdataApiUrl: string, sdataUsername: string,
  2.     sdataPassword: string, user: UserModelType): void => {
  3.     axios.post(`${sdataApiUrl}/accounts`, {
  4.         'AccountName': user.lastName + ', ' + user.firstName,
  5.         'Contacts': {
  6.             '$resources': [{
  7.                 'Email': user.email,
  8.                 'FirstName': user.firstName,
  9.                 'LastName': user.lastName
  10.             }]
  11.         }
  12.     }, {
  13.         auth: {
  14.             username: sdataUsername,
  15.             password: sdataPassword
  16.         },
  17.         headers: {
  18.             'Content-Type': 'application/json',
  19.             'Accept': 'application/json'
  20.         }
  21.     }).then(function(response) {
  22.         console.log('post success: ', response);
  23.     }).catch(function(error) {
  24.         console.log('post error: ', error);
  25.     });
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement