sendinblue / APIv3-nodejs-library

SendinBlue's API v3 Node.js Library
ISC License
101 stars 47 forks source link

Please exemples #17

Closed clementAC closed 6 years ago

clementAC commented 6 years ago

Can you provide usage exemple of this node js sdk? This kind of tool should save time and without exemples it's not the case

Thanks in advance

ekta-slit commented 6 years ago

Hi @clem91

Here https://github.com/sendinblue/APIv3-nodejs-library#documentation-for-api-endpoints each method has a link to its sample. Also a working sample to create an email campaign with required input parameters can be found here https://account.sendinblue.com/advanced/api

Hope that helps!

Thanks SendinBlue Team

clementAC commented 6 years ago

Hi, I was talking about the type developer has to create in order to use the sdk. For exemple if you take the create list function exemple var createList = new SibApiV3Sdk.CreateList(); // CreateList | Values to create a list

// CreateList | Values to create a list

is not really a nice and complete exemple and you have to dig deeper in the doc to find what kind of parameters it accept (here again without exemple => createList type ). I was thinking first it was json parameters but it was not the case... it's normal parameters. Whithout clear exemple I lost some times doing try&learn.

Sincerely yours

ekta-slit commented 6 years ago

Hi @clem91

Some of the APIs have quite large number of input parameters & It's quite not neat to provide each and every input parameter in a sample, and that we why we have parameter description table with type defined for each parameter properly.

Passing inputs is quite easy though ;)

var apiInstance = new SibApiV3Sdk.ContactsApi();

var createList = new SibApiV3Sdk.CreateList(); // CreateList | Values to create a list

createList.name = 'mylist';
createList.folderId = 10;

OR

createList = {
  name: 'mylist',
  folderId: 10
}

apiInstance.createList(createList).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Hope that helps!

Thanks