14
Views
12
Comments
Solved
Stumped on REST
Question

Hello All

I am stumped on this REST Call I am trying to integrate with one of my apps. 


It's a Transactional Email (Post) call to the SendInBlue API

I have added the service successfully in my logic tab and the required structures have been inherited too.


I am then adding the call into an action where I am adding all the required information into the record for sending:


When I run the action it keeps failing - returning a 400 Bad request.

I can see in the debugger that correct info is assigned to the record, which then fed into the api call but I can't understand why it's failing. 


Please show me the error in my ways? :) 


Error1.png

Rank: #2463
Solution

Hi Craig,

Is EmailInfo a list? If so you will need to append to it instead of assigning directly to Current. Let me know if that solves the issue.

Rank: #3112

Quentin P wrote:

Hi Craig,

Is EmailInfo a list? If so you will need to append to it instead of assigning directly to Current. Let me know if that solves the issue.

 Yes, it is a list - I'm a total noob so would you mind explaining how to append?

 

Rank: #390

Hi,

First you try to run it form the rest service test option. If you are getting 400 then some how the request is not generating properly. Check also if you are missing any mandatory header that requires at the time of send request.

Rank: #3112

Sourav Pasari wrote:

Hi,

First you try to run it form the rest service test option. If you are getting 400 then some how the request is not generating properly. Check also if you are missing any mandatory header that requires at the time of send request.

 

 Hi Sourav - thanks, I did this as I was adding in the service and the tests were successful - Used that request and response to create the structure.   

Rank: #2463

Are you able to get any clues from Integration Logs in Service Center?

mvp_badge
MVP
Rank: #75

Hi Craig,

I would suggest you to check the error stack after increasing the API Logging level using Service Center. Please refer the below mentioned link

https://www.outsystems.com/forums/discussion/33272/setting-logging-level-of-a-rest-api/#Post115662


Regards,

Benjith Sam

Rank: #3112

Thanks Quentin and Benjinth 


That helped - The error is telling me that the customer detail of (Name and Email) is not being passed into the call. 

I'm confused because I can see the values in the debugger being passed. These two items are the only elements that make up the "to" object of the structure. Is there a different method of adding this in?


Rank: #390

Craig Schrickker wrote:

Thanks Quentin and Benjinth 


That helped - The error is telling me that the customer detail of (Name and Email) is not being passed into the call. 

I'm confused because I can see the values in the debugger being passed. These two items are the only elements that make up the "to" object of the structure. Is there a different method of adding this in?


 

 Hi,

One thing I can suggest you - fiddler. Make a request and check the request in fiddler. You can change the request in fiddler and re-request. Then you can understand which value actually giving you the issue.

Rank: #2463

Craig Schrickker wrote:

Thanks Quentin and Benjinth 


That helped - The error is telling me that the customer detail of (Name and Email) is not being passed into the call. 

I'm confused because I can see the values in the debugger being passed. These two items are the only elements that make up the "to" object of the structure. Is there a different method of adding this in?


Hi,

Did you enable Full logging like Benjinth suggested? You should be able see the request JSON body being sent as well. 

This can help to tell if the name and email are being sent as empty or if they are being sent but the error still reports that they are not passed (which may suggest a typo perhaps).

Rank: #2463
Solution

Hi Craig,

Is EmailInfo a list? If so you will need to append to it instead of assigning directly to Current. Let me know if that solves the issue.

Rank: #3112

Quentin P wrote:

Hi Craig,

Is EmailInfo a list? If so you will need to append to it instead of assigning directly to Current. Let me know if that solves the issue.

 Yes, it is a list - I'm a total noob so would you mind explaining how to append?

 

Rank: #2463

You will need to have a local variable with the data type of the To list (I'm assuming this data type is called "To").

1. Assign To.Name = Am......FirstName, To.Email = Am......Email

2. ListAppend to EmailInfo.To your local variable.

Rank: #3112

That worked THANK YOU Quentin - add the list Append