Creating a POST request in Paymo by calling a REST service

2
Hello,   I've been trying to create a POST request for a time entry in Paymo by calling a REST service in Mendix through the Paymo API (https://github.com/paymoapp/api/blob/master/sections/entries.md). I'm able to create a valid POST request in Fiddler but I can't get it to work in the Modeler. This is the input I use in Mendix for the POST request: And this is an example of a valid POST request in Fiddler (for the example I used the same data used for testing the POST request in Mendix): When I create the request in Fiddler I receive a '201 created' notification and when I create the request in the Modeler I receive a '400 Bad request' notification. So I assume I made a mistake in configuring the REST service call in Mendix. Does anyone know how I can solve this problem?   Thanks in advance.  
asked
2 answers
8

Hi Cas,

The best way to go in this case is to use a mapping.

  1. Create a json structure document in the modeler and past a json example snippet
  2. Create a export mapping and choose the above created json structure as a source
  3. Map the root element on the right with your own entity that holds the data for the request, judging from your screenshots that entity is probably named "Entry"
  4. In the call rest service activity in your microflow be sure to select the correct mapping and the correct parameter ($NewEntry, in your case)

 

That should do the trick! Good luck!

answered
0

Hi Cas,

 

I see that your parameters for the custom request template are not enclosed by quotes, like in the example. 

Also you can use the console in the modeler to set different log levels for the rest operations to see what happens when you try to send the message.

 

Kind regards,

Jeffrey

answered