michiko.takahashi | 2020-01-27 00:37:26 UTC | #1
Hi, everyone. I am trying to integrate a Web Service (Post) of BigQuery and Purecloud with data actions based on HTTPS. It works in postman but I receive the following error when i make a test in Actions, it seems like the requestUrl is illegal which confused me.
{ "status": 500, "code": "internal.server.error", "message": "javax.ws.rs.core.UriBuilderException: Failed due to malformed requestUrlTemplate. Illegal character in path at index 109: <REDACTED>", "messageParams": {}, "contextId": "f2beecaa-b802-4f25-984d-c7f735d04242", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [] }
input contract: { "title": "BigqueryInput", "type": "object", "properties": { "ConvId": { "type": "string" }, "IntentName": { "type": "string" }, "Result": { "type": "string" } }, "additionalProperties": true }
output contract: { "type": "object", "properties": {}, "additionalProperties": true }
configuration: { "requestUrlTemplate": "https://bigquery.googleapis.com/bigquery/v2/projects/xxxxxx/datasets/xxx/tables/xxxxx/insertAll", "requestType": "POST", "headers": { "Content-Type": "application/json", "Authorization": "Basic $encoding.base64(\"${credentials.ClientId}:${credentials.ClientSecret}\")" }, "requestTemplate": "{\"granttype\":\"clientcredentials\",\"rows\":{\"insertId\":\"\",\"json\":{\"ConvId\":\"$(input.ConvId}\",\"IntentName\":\"${input.IntentName}\",\"Result\":\"${input.Result}\"},\"scope\":\"https://www.googleapis.com/auth/bigquery.insertdata\"}" }
Jason_Mathison | 2020-01-27 15:07:30 UTC | #2
Hi michiko.takahashi,
You may need to do explicit URL escaping on the values you are inserting into your UrlTemplate. See here for documentation https://help.mypurecloud.com/articles/velocity-macros-data-actions/#StringEscaping Specifically, you may need to wrap the variables with $esc.url() to get them correctly escaped.
--Jason
michiko.takahashi | 2020-01-28 03:26:48 UTC | #3
Hi Jason. As you said , i try to change my configuration as below: { "requestUrlTemplate": "$esc.url('https://bigquery.googleapis.com/bigquery/v2/projects/xxxxxx/datasets/xxx/tables/xxx/insertAll')", "requestType": "POST", "headers": { "Content-Type": "application/json", "charset": "UTF-8", "Authorization": "Basic $encoding.base64(\"${credentials.ClientId}:${credentials.ClientSecret}\")" }, "requestTemplate": "{\"granttype\":\"clientcredentials\",\"rows\":{\"insertId\":\"\",\"json\":{\"ConvId\":\"$(input.ConvId}\",\"IntentName\":\"${input.IntentName}\",\"Result\":\"${input.Result}\"},\"scope\":\"https://www.googleapis.com/auth/bigquery.insertdata\"}" }
But, it still return the same error. Any ideas?
{ "status": 500, "code": "internal.server.error", "message": "javax.ws.rs.core.UriBuilderException: Failed due to malformed requestUrlTemplate. Illegal character in path at index 109: <REDACTED>", "messageParams": {}, "contextId": "abfa4d14-829f-4db9-b920-2b5bf4284c1b", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [] }
Jason_Mathison | 2020-01-28 12:55:57 UTC | #4
Hi michiko.takahashi,
Sorry for the confusion, you don't want to URL encode the whole URL string. You only want to URL encode the variables that you are substituting into the URL template. So something like
"requestUrlTemplate": "'https://bigquery.googleapis.com/bigquery/v2/projects/$esc.url(${input.project_name})/datasets/$esc.url(${input.dataset_name})/tables/$esc.url(${input.table_name})/insertAll')",
If you continue to have problems could you post an export of your action so I can see exactly what you are trying to do? Also, I have been discussing with my team how to improve the error message and overall experience with URL templates.
--Jason
michiko.takahashi | 2020-01-28 14:43:19 UTC | #5
Hi Jason I try to encode the variables but also have the same problem. I can't upload an attachment as i'm new user, so could you give me your e-mail then i can send the action to you.
Thanks,
tim.smith | 2020-01-28 14:46:46 UTC | #6
I've bumped your level up; you should be able to upload now.
michiko.takahashi | 2020-01-28 15:05:11 UTC | #7
Hi tim, Thank you. I upload my action and hope you can find where the problem is? :blush:
<a class="attachment" href="/forum/uploads/db6296/original/2X/5/5603f2b47b52d0638d8d01399833dae8e99f744b.json">testLingBQ-20200128233704.custom.json</a> (1.5 KB)
Jason_Mathison | 2020-01-28 15:17:43 UTC | #8
I am not sure why you have been having URL template problems. Since you are not doing any variable substitution I don't see any need for esc.url(). I am attaching a version that passes the URL template step.<a class="attachment" href="/forum/uploads/db6296/original/2X/0/007bfc82298088a0be637a47a156db53b2e0455c.json">testLingBQ---Exported-2020-01-28--2337-20200128101607.custom.json</a> (1.5 KB)
michiko.takahashi | 2020-01-28 15:41:00 UTC | #9
I test the version you attached me and have the same problem.:joy: Could it be a integration issue? But i don't know how it cause a requestUrlTemplate error. I will check.
tim.smith | 2020-01-28 15:50:43 UTC | #10
The latest error for that data action test appears to have been done just before the top of the hour (2:59 PM UTC) and had the error message below. It looks like there's a space that's somehow getting added into the URL after SureyFromPurecloud.
michiko.takahashi | 2020-01-28 16:01:52 UTC | #11
I test the action again and make sure there is no space in URL but also have the error below:
{ "status": 500, "code": "internal.server.error", "message": "javax.ws.rs.core.UriBuilderException: Failed due to malformed requestUrlTemplate. Illegal character in path at index 109: <REDACTED>", "messageParams": {}, "contextId": "c8d0c120-138a-429c-b14e-082b10c6c5a3", "details": [ { "errorCode": "ACTION.PROCESSING" } ], "errors": [] }
Jason_Mathison | 2020-01-28 16:07:29 UTC | #12
Please upload a new export of the action. So far I have not been able to reproduce the issue you are having.
Jason_Mathison | 2020-01-28 16:19:45 UTC | #13
michiko.takahashi please open a case with customer care. We may need someone to look at your action to figure out what is going on.
Jason_Mathison | 2020-01-28 16:41:11 UTC | #14
I believe that Tim is right that you have an extra space in your URL template before the /insertAll
system | 2020-02-28 16:41:11 UTC | #15
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 6989