Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleGet the access token and the refresh token
curl -X POST -d "grant_type=password&client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&username=MYUSERNAME&password=MYPASSWORD" /
		https://services.mailup.com/Authorization/OAuth/Token


Examples:
- MYUSERNAME=m1234
- MYCLIENTID=0a111fe1-aaaa-bbbb-cccc-f33d3d3efcd3
- MYCLIENTSECRET=f00b000e-aaaa-bbbb-cccc-8f2a92111dde

Response:
{	
	"access_token":"MYACCESSTOKEN",
	"expires_in":3600,
	"refresh_token":"MYREFRESHTOKEN"
}
 

 

Resource access

After passing the authorization process, the client application impersonates a MailUp user. Then, the resources the user is enabled to get or set are accessible by calling related API endpoints. For more detailed information about available resources and related API methods, please refer to the specific documentation of the REST API Resources

...

Code Block
titleRefresh the access token
// #1 When resource access fails because token is expired
curl -H "Authorization:Bearer MYACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" MYRESOURCEENDPOINT 
Response:{"ErrorCode":"401","ErrorDescription":"Authorization error: Access token is expired","ErrorName":"Unauthorized","ErrorStack":null}
 
// #2 First you need to get a new token
curl -X POST -d "client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&refresh_token=MYREFRESHTOKEN&grant_type=refresh_token" /
		https://services.mailup.com/Authorization/OAuth/Token
Response:{	"access_token":"MYNEWACCESSTOKEN","expires_in":9003600,"refresh_token":"MYREFRESHTOKEN"}

 
// #3 Then you can successfully access to the resource by using the new token
curl -H "Authorization:Bearer MYNEWACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" MYRESOURCEENDPOINT 

...

Code Block
titleRefresh the access token
curl -H "Authorization:Bearer MYACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" /
		https://services.mailup.com/API/v1.1/Rest/ConsoleService.svc/Console/List/1/Groups

Response:
{	
	"ErrorCode":"403",
	"ErrorDescription":"Authorization error: Contract not signed, please login in console and accept terms of service.",
	"ErrorName":"Forbidden",
	"ErrorStack":null
}

 

Access errors due to "Too Many Requests" (HTTP 429)

...

Code Block
titleRefresh the access token
curl -H "Authorization:Bearer MYACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" /
		https://services.mailup.com/API/v1.1/Rest/ConsoleService.svc/Console/List/1/Groups

Response:
{	
	"ErrorCode":"429",
	"ErrorDescription":"Authorization error (too_many_requests): The call quota is exhausted. Max: 5 calls/second, actual: 9 calls/second, throttling condition expires in: 291 ms, throttling config: 2.",
	"ErrorName":"TooManyRequests",
	"ErrorStack":null
}