You can translate the question and the replies:

HTTP Headers for an external REST service

We have to integrate with a SaaS HR system which exposes everything RESTfully. To search with a filter, I have to make a POST and pass in a JSON header according to their syntax. I have the following working so far as my header - this will create 2 required interpolation variables for emplid and formname. Works just great. \{"filters": [ \{"name": "formdata.person.externalid", "value": ["@emplid"], "operator": "=" \}, \{"name": "formdata.form.formname", "value": ["@formname"], "operator": "=" \} ] \} Now some of the time I need to search on an additional field (@jobid), but I didn't want to make a separate connection/view for this field. The new header would look like this: \{"filters": [ \{"name": "formdata.person.externalid", "value": ["@emplid"], "operator": "=" \}, \{"name": "formdata.form.formname", "value": ["@formname"], "operator": "=" \}, \{"name": "formdata.job.id", "value": ["@jobid"], "operator": "=" \} ] \} How would you handle something like this? I tried messing around with ^ExecuteIfIsNotNull, but it didn't seem to work. Because I coded this filter into the header, I have to pass it a jobid or the SaaS system won't return me the data. I'm guessing it require another view, but I'd like to hear some options.
user
24-07-2015 12:52:05 -0400

2 Answers

Hi! What you can do in this case is to make the interpolation parameter to contain the whole json part for it. This way, your json would look something like this: \{"filters": [ \{"name": "formdata.person.externalid", "value": ["@emplid"], "operator": "=" \}, \{"name": "formdata.form.formname", "value": ["@formname"], "operator": "=" \} @jobidjson ] \} Once you have the base view, next step is to create a derived view over it. In this derived view: First, create a view parameter over the view called for instance 'jobidparam' with default value: 'no_id'. Finally, create a where condition over the field 'jobidjson' like this one: case WHEN (jobidparam= 'no_id') THEN ' ' ELSE ' \{"name": "formdata.job.id", "value": [" '|| jobidparam ||' "], "operator": "=" \}' END Querying this derived view will perform what you are looking for. If you provide a value to jobidjson, it will concatenate the json needed to the header. If you don't provide it, it will contain just the other parameters. Hope this helps!
Denodo Team
27-07-2015 10:51:20 -0400
Very cool - let me give that a shot!
user
29-07-2015 10:16:28 -0400
You must sign in to add an answer. If you do not have an account, you can register here