CROSS platform API

Leo

New Member
https://github.com/thangtx/mailwizzphpapi-wrap
https://api-docs.mailwizz.com/

Been trying to integrate some sort of list importation, campaign activation automation with my own Ruby on rails app. my problem with mailwizz api is that it is only limited to php, i also tried the wrapper provided, the last maintain was 4years ago on github. Can't seem to work properly now :/

a5UWI1Z.png




Admin, is it possible to make it able to support universally instead of just limited to just php? the idea of having an API so that it should work on any platform, waiting on someone in community to build a wrapper it's not a good idea, i also realize u mentioned the signature only can produce within php, perhaps u can share on the algorithm how to produce it? so i can reverse engineer on how to make a request. lastly, also please list out the URL endpoint of each method.
maybe u can build your api documentation using this apirary.io
something like this, saving developers headache to try to reverse engineer
https://pandurangpatil.docs.apiary.io/

right now i can't use mailwizz due to this, i have to search for other solution, i know these are not refundable, maybe admin can shed some light on how can i solve this :'(
 
@Leo - we also have a ruby version of the API client but hasn't been published just yet because we're not done with it.
@ghimes - what's the status of this?

As for signature, you can simply disable it from mailwizz and then you don't need to worry about it on client side.
 
@Leo - we also have a ruby version of the API client but hasn't been published just yet because we're not done with it.
@ghimes - what's the status of this?

As for signature, you can simply disable it from mailwizz and then you don't need to worry about it on client side.


u mean for private key, public key signature thing can be disable in the backend? where to do so? after disable it i can make request via postman? because if i were able to make a request on any http client, then i will able to do it on ruby easily
 
@Leo - In backend > settings > api set "Disable signature check" to Yes, this will disable the check for signature hash.
You will still need to provide the X-MW-PUBLIC-KEY and X-MW-TIMESTAMP header, but this means you can supply this in a header and make requests with postman, see:
Screenshot 2019-12-16 20.00.59.png
 
@Leo - In backend > settings > api set "Disable signature check" to Yes, this will disable the check for signature hash.
You will still need to provide the X-MW-PUBLIC-KEY and X-MW-TIMESTAMP header, but this means you can supply this in a header and make requests with postman, see:
View attachment 8887

alright, that's awesome man! anyway can u list out all the URL endpoints? like this below beacuse on the your documentation it doesnt seem to show endpoint url https://api-docs.mailwizz.com/#lists

Show all list
GET https://example.com/api/index.php/lists
Create List
POST https://example.com/api/index.php/lists



thanks man really appreciate it
 
thanks i managed to look into the endpoint inside the SDK, managed to get all list of endpoint url. however for this SDK you should turn it into a ruby GEM, https://rubygems.org/ so people can actually integrate it into a rails project.

vzaa423.png



anything i did wrong here? why error says "Name cannot be blank", it was included in the JSON body, i am confuse, or it needs to be a x-www-form format?
 
I managed to solve this, apparently they don't take JSON as body request they take x-www-form-urlencoded, so for anyone looking on how u can make post request via http client this is the way to do it

tSJdfWU.png
 
@twisted1919 hey man i realize there is one endpoint missing.
I was trying to create custom list field programmatically,

POST /lists/:list-id/fields this doesnt work


Or i can set it globally somewhere? i look through settings of customer and admin backend doesnt seem to have option tho. only have FNAME and LNAME tag in default, how can i add more default ? thanks
 
For missing things you can actually try and write your own api endpoints, should not be too hard, then use the api client to access them.
If you need to add more defaults to all lists, you can do it using hooks, either from an extension, theme, or simply by creating a file called init-custom.php in the /apps/ folder and place this into it:
PHP:
<?php

Yii::app()->hooks->addAction('after_list_created_list_default_fields', function ($params) {
    $type = ListFieldType::model()->findByAttributes([
        'identifier' => 'text',
    ]);

    $model = new ListField();
    $model->list_id    = $params->list->list_id;
    $model->type_id    = $type->type_id;
    $model->label      = 'Age';
    $model->tag        = 'AGE';
    $model->required   = ListField::TEXT_NO;
    $model->sort_order = $params->lastSortOrder++;
    $model->save();

    $model = new ListField();
    $model->list_id         = $params->list->list_id;
    $model->type_id         = $type->type_id;
    $model->label           = 'Favourite Color';
    $model->tag             = 'FAVCOL';
    $model->default_value   = 'green';
    $model->required        = ListField::TEXT_NO;
    $model->sort_order      = $params->lastSortOrder++;
    $model->save();
});

The above will make sure each new list will get these two new custom fields, which of course, you can edit as you see fit.
 
  • Like
Reactions: Leo
lPUEITS.png


@twisted1919
New issue with campaign endpoint, as u can see i've provided template_uid above but i kept getting Please provide a template error, i've saved the template in my mailwizz. any idea whats missing?
 
Last edited:
Commenting out this line at 325 of CampaignsController.php doesn't seem to work either. it will return new error
""content": "Content cannot be blank."" really don't know what cause this error.

PHP:
if (empty($template->content)) {
            return $this->renderJson(array(
                'status'    => 'error',
                'error'     => Yii::t('api', 'Please provide a template for your campaign.')
            ), 422);
  }
 
@Leo - Does the template with that uid exists and belongs to that customer who does the api request?
Yes I use api public key from the same customer account and I only have 1 customer account, I’ve also uploaded the template before, I got the uid from the get templates endpoint

@twisted1919 i just pm you my login details, maybe u can help me diagnose what do i miss
 
Last edited:
Back
Top