mailtrain
mailtrain copied to clipboard
Update api.js
Exclude MERGE_FIRST_NAME und MERGE_LAST_NAME from being lowercased to preserve user input.
The API is something I took over from Mailtrain v1. Overall, it's not in a good shape. I'm not sure why the lowercase is there, but we cannot remove it as other might depend on it. At the same time, the names of custom fields could be pretty much anything and you cannot rely on names to be MERGE_FIRST_NAME, etc. I'd suggest to add a parameter (e.g. "CASE_SENSITIVE"), which if you set to true, it won't do the lowercase.
Well I tried wether the other parameters would be affected. But couln't spot a difference. I don't quite get what you are trying to say depending custom fields concerning the matter^^ But yeah one could easy just imlement a CASE_SENSITIVE parameter to handle the input case.
Great. I just wanted to say that name doesn't have to be called MERGE_FIRST_NAME. So we should not rely on a set of predefined merge tags in the api.
Oh so what you want to say is, that we should change the name of the parameters to FIRST_NAME and LAST_NAME in the application in general, instead of adjusting everything to the given parameter names MERGE_FIRST_NAME and MERGE_LAST_NAME?
Well if I understood you correctly, I admit, this would be better. Will try to do it in the next days...
Since you said, the code is legacy from v1 and not in best shape, is there any general wish to refactor the api code? Would be willing to open a branch ;)
Indeed I had such a wish for a long time. But since I don't need the API for anything I do, it always had zero priority on my side. If you want to give it a try, I would be happy to help with consultation. I think it would make sense to first create some spec (e.g. on Apiary) and discuss it. I would like to consider it as brand new API. We may use API version identifier in request headers. That would allow us to come up with new behavior and still keep some level of backward compatibility.
Sure, if you're willing to help with consultation, I'd love to contribute! Your suggestions sound like a legit approach. Can you recommend good resources to get started with apiary? I have not used it so far. I would start with building a API Spec inspired by the current api to have something concrete to discuss about.
Thanks. Great. I didn't use it either. It was just a suggestion based what I saw in other projects.
Well seems like a good tool to design, develop and test APIs. Will start in simply creating one for the status quo of mailtrain v2 external API in the next couple of days.
Do you use triggered campaigns a lot or at all? And does it work? I did not manage to fire up the triggers the other day.
Finally got to start working on the API doc in apiary. Setup a project and synced it with my mailtrain fork on github. https://lucashankedecansino.docs.apiary.io/#