Questa pagina è un work in progress con visibilità ristretta a Cigoli, Miscia, Gorni, Arrigoni
URL degli endpoint del servizio MailUpService:
Endpoints
SOAP: http://services.mailupnet.it/1.0/MailUpService.svc
REST: http://services.mailupnet.it/1.0/MailUpService.svc/rest
Methods
Authentication
Login and logout methods. Login returns an access key that can be used as parameter when calling other methods.
- AuthenticationLogin
- AuthenticationLogout
Filters
Create and delete MailUp filters.
- FiltersCreatePersonalDataFilter
- FiltersDeletePersonalDataFilter
- FiltersCreateActivityFilter
- FiltersDeleteActivityFilter
- FiltersCreateGeographicFilter
- FiltersDeleteGeographicFilter
Test
This method can be used to test the service
- Ping
Restrictions
- REST is supported only when XML parameters are passed with http POST method (Ping method is the only exception, which can be called using http GET http://services.mailupnet.it/1.0/MailUpService.svc/rest/Ping)
- JSON is not supported
How to use REST
Client configuration in ASP.NET
Add the following entries in web.config file to enable REST
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> ... <behaviors> <endpointBehaviors> <behavior name="restBehavior"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> <service behaviorConfiguration="MailUp.WS.Host.Web.MailUpServiceBehavior" name="MailUp.WS.Service.MailUpService"> <endpoint address="rest" binding="webHttpBinding" contract="MailUp.WS.Contract.IMailUpService" behaviorConfiguration="restBehavior"/>
Example
Call http://services.mailupnet.it/1.0/MailUpService.svc/rest/AuthenticationLogin passing the following XML as parameter in HTTP POST: <LoginRequest> <Username>xxxx</Username> <Password>yyyy</Password> <IdConsole>10001</IdConsole> </LoginRequest>
XML response when request is successful ("Token" is the returned Access key): <LoginResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Token>A973Amr5FJZzsZukgfdBkjblveNL8TKnqc5iLjDyixLDF9VdTx0M9N9z4Hiw=</Token> </LoginResponse> Unsuccessful response: HTTP 400 Bad Request
Per configurare REST è sufficiente aggiungere le seguenti configurazioni nel web.config:
- <system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
….
- <behaviors>
….
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
- <service behaviorConfiguration="MailUp.WS.Host.Web.MailUpServiceBehavior" name="MailUp.WS.Service.MailUpService">
<endpoint address="rest" binding="webHttpBinding" contract="MailUp.WS.Contract.IMailUpService" behaviorConfiguration="restBehavior"/>
ESEMPIO login REST:
URL della risorsa: http://services.mailupnet.it/1.0/MailUpService.svc/rest/AuthenticationLogin
Metodo HTTP: POST
Richiesta XML:
<LoginRequest>
<Username>xxxx</Username>
<Password>yyyy</Password>
<IdConsole>10001</IdConsole>
</LoginRequest>
Risposta XML in caso di esito positivo:
<LoginResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Token>A973Amr5FJZzsZukpT51+XHeXh78NldYNkIJdIoayt8aGrvSr1uld2ta+U32KJkbN5oRbLb5Cptjbfjz4gWOoAhzin47vUZKFkobffUHXPOxocW9oQKvNDZAp7NcFpggfdBkjblveNL8TKnqc5iLjDyixLDF9VdTx0M9N9z4Hiw=</Token>
</LoginResponse>
Risposta in caso di esito negativo:
Codice di stato HTTP 400 Bad Request