API documentation

Duarte

New Member
Hi guys,

Does anyone know where is the documentation for API. I'm using .net solution and i need to call the api using a rest client, but i'm not finding the documentation.

I found the sdk for php but it's difficult for me to figure out what are the url and parameters we need to send. Basically if someone can post here a http request sample would really help me.

What i need to know is basically how to send the private/public keys, should we send it on http header, body query string?

Urls for subscribe and unsubscribe is all we need.
 
@Duarte - The SDK is a bit more complex in that it creates a unique signature from your entire request. It signs that using the private key and sends the public key along so that the server can use it to fetch the private key and match the signature with it.
See this in order to understand the signing process.
I am not sure how the above should be done in .NET but isn't it simpler to setup the php sdk on a php server then prepare some urls that you will call from .NET, this way you use the php-sdk as a bridge between .NET and mailwizz ?
 
@twisted1919 - First of all thks for your quick response. Is it possible to you to post a request sample? for instance a test you made on fiddler or that type of application. If i can understand the http request i can do it easily on .net.

from what i saw i should send the public key on request header with the param name- X-MW-PUBLIC-KEY the private key is sent on header two and encrypted with sha1 and all the parameters are appended to query string. Is that right?

i will make a test right now
 
@Duarte - It's not just sha1, hash_hmac uses a key to hash the data, see the docs here.
The request signature will contain as follows:
This array as specified here: https://github.com/twisted1919/mailwizz-php-sdk/blob/master/MailWizzApi/Http/Request.php#L227-L231
Then, over that array we add the arrays: https://github.com/twisted1919/mailwizz-php-sdk/blob/master/MailWizzApi/Http/Request.php#L238-L240 (that is: post data[if any] / put data[if any] and delete data[if any]. this is the data that is sent with the request, for instance a delete request will use the delete data and so on).
Then we sort all the params by their keys: https://github.com/twisted1919/mailwizz-php-sdk/blob/master/MailWizzApi/Http/Request.php#L243 this is very important.
Then we construct the signature string. The signature string is something like:
Code:
// METHOD -> FULL URL WITH PARAMS
POST https://www.yourdomain.com/api/index.php/lists/er128gdta2/subscribe?EMAIL=abc@domain.com&FNAME=John@LNAME=Doe&X-MW-PUBLIC-KEY=x&X-MW-TIMESTAMP=y&X-MW-REMOTE-ADDR=z
Then, we use hash_hmac and the private key to hash the signature string and to obtain the signature hash which will be sent as the X-MW-SIGNATURE header.

Not sure how much it helps, but if i can shed more light on this, let me know.
 
Back
Top