REST Proces return values not returning success

Hey,

From our telephone-provider we expect to get a telephone number through a POST, when contacts have been found with this phone we will return a parameters list with the contacts inside.
Request, on body:

{
    "action": "lookup",
    "number": "0612345678"
}

Expected response:

{
    "succes": true,
    "parameters": [
     {
         "name": "Jesse",
         "id": 1,
         "customer_view": .....
     },
     {
         "name": "Jesse 2",
         "id": 2,
         "customer_view": .....
     },
     ]
}

Actual response:

{
    "parameters": [
     {
         "name": "Jesse",
         "id": 1,
         "customer_view": .....
     },
     {
         "name": "Jesse 2",
         "id": 2,
         "customer_view": .....
     },
     ]
}

Sadly, my current configuration doesn’t return the “success” message in the response, but as far as I know I do have this configured that is has to send the success status:

How can I make it so that both success and on the same level parameters are returned in the response?

Kind regards

Hi Jesse,

My guess is that, in this REST process, the checkbox “custom response” is checked.
image

This checkbox filters the ‘success’ and ‘error’ from the response.
Leaving it unchecked should give the result you are looking for.

Hey Yori,

Thanks for the response, although this does seem to work it completely changes the response and I don’t know if this is the reason why it doesn’t work testing it through our phone provider.

{
    "success": true,
    "error": null,
    "response": {
        "parameters": [
            {
                "name": "Jesse TEST",
                "id": 9303,
                "customer_view": "...."
            }
        ]
    },
    "httpcode": 200
}

The documentation I’m using wants a success and parameters only, do you think this is the reason why it looks like it doesn’t work when I call to the phonenumber I’m testing with?

Jesse

Hi Jesse,

the format difference could be the reason it doesn’t work but it could also be something else.

Does the application of your phone provider provide some kind of logging?
That can tell us more about the reason it doesn’t work.

Have a nice day!

Hey Geertjan,

This is the log:

[HTTPRequesterAdvancedConnector][I] Evaluate entries that have a lookup action.
[HTTPRequesterAdvancedConnector][I] Entry Novulo evaluated True. ('number->+316XXXXXXX' is_not_empty '' => True)
[HTTPRequesterAdvancedConnector][I] Sending POST request to https://vds89.novulo.com/dugardijntest/rest/bubble/find-contact-by-phone/APIKEY. Content: {"number": "+316XXXXXXX"}
[HTTPRequesterAdvancedConnector][I] Response code: OK: {"parameters":[{"name":"Jesse TEST","company_id":9303,"customer_view":"http://vds89.novulo.com/dugardijntest/default.aspx?organization_id=9303"}]}
[HTTPRequesterAdvancedConnector][I] Action is lookup action, trying to parse result parameters.
[HTTPRequesterAdvancedConnector][I] No result found for number: +316XXXXXXX

It looks like it’s working, but it not processing the data I’m sending through… Might not be a problem in Novulo but I have to say that the format is not the format the response should be.

So In the end the custom response of Novulo’s REST to doesn’t work accordingly right? Since I don’t have full control of the response format

Hi,
Custom response works as intended. Here is some basics/background.
Standard response (custom_response off) is in the format

{
    "success" : boolean,
    "error" : string,
    "response"  ...process return values... (can be list of objects, can be object)
}

Custom response = on - its usage is to get rid of the novulo-standard keys in the response, so you get only the actual data. So with custom response ON you correctly as i would’ve expected you get only

{
   "parameters" : [...]
}

I am not quite getting the use-case here. You call the novulo endpoint, you get the response above - are you sending it to some other API ?
If yes - then before calling the other API, can’t you process the novulo response ?

  • custom response off - you get success, you get parameters (within the response key)
  • custom response on - well you can assume success is true (success, error, http code are returned in case of actual error, regardless of the custom response setting)

Success, error and response are reserved key names - these are standard names (success and error being process standard names, response something introduced by the Restful webservice itself, i’m not quite familiar with the design decision here, but REST Endpoints were made so they follow the same format as the Restful webservice plugin did give, before the implementation of the configurable endpoints, in order to keep backwards compatibility for endpoints that are configured using the old way).

Hey @m.gechev,

I don’t really get what you’re saying at the end. But I’ll try to explain my use-case.
Our phone provider has a program which wants to POST towards Novulo, this with a phone number.

With this POST towards Novulo, they expect a certain response, with the format as listed below. With “Success”: True (or False) included in the response. I wanted to also include this in the custom_response on. The response is indeed back to the application of our phone provider.

The problem here is that even if I add the following:


It doesn’t add these to the response above the parameters response.

I’m assuming that if I don’t respond in the format that the application from the phone provider expects, it doesn’t understand how to read the information. This is the respond they expect:

 { 
     "success" : true , 
     "parameters" : [ 
         { 
             "name" : "John Doe" , 
             "company_name" : "Legal Company" , 
             "customer_id" : 1234 , 
             "customer_view" : "http://192.168.2.1/customer/1234" 
         }, 
         { 
             "name" : "Bart Storm" , 
             "company_name" : "Legal Company" , 
             "customer_id" : 1234 , 
             "customer_view" : "http://192.168.2.1/customer/1234" 
         } 
     ] 
}

Or when it fails:

{ 
     "success" : false , 
     "parameters" : {} 
} 

Kind regards,

Hi Jesse,

If its a 3rd party doing the request and there is no way to change the way the response is processed, then I am afraid that the response body you need is currently impossible to be given.

If this needs to change, then I suggest that you raise a feature request SR for product S161.


The problem here is that even if I add the following:…
…It doesn’t add these to the response above the parameters response.

That is because you have custom response ON, which as said above - when custom response is ON you only get what is within the “response” key