Solved

How to include a $ as part of string for HTTP uri

  • 22 August 2022
  • 2 replies
  • 80 views

Hello,

I’m trying to make an api call to SharePoint using the HTTP Originator however I am receiving an illegal character error for the $ when using the following uri:

https://mysite.sharepoint.com/sites/site-name/_api/Web/Lists/GetByTitle('List Name')/Items?$filter=(FSObjType eq 0) and (Field ne null)&$select=File/ServerRelativeUrl,Id,Field1,Field2,Field3,Field4&$expand=File

The uri above works in postman and if the uri contains no operators then it works in Streamsets. I need it to work in Streamsets with the operators.

I’ve tried

  • \ in front of $
  • \\ in front of $
  • encoding the whole string
  • encoding parts of it
  • I’ve copied the working uri from the postman logs to match the encoding
  • Using the concat function
  • Setting the string as a pipeline parameter

Does anyone have a way to solve this?

Many thanks

icon

Best answer by Pete 23 August 2022, 03:50

View original

2 replies

Userlevel 2
Badge +1

@Pete ,

 

can you try encode method https://docs.streamsets.com/controlhub/latest/help/transformer/Apx-Expressions/FunctionsList.html#concept_wcy_sr4_rlb and see if it works

sample: 

https://mysite.sharepoint.com/sites/site-name/_api/Web/Lists/GetByTitle('List Name')/Items?${base64:encodeString("$filter=(FSObjType eq 0) and (Field ne null)&$select=File/ServerRelativeUrl,Id,Field1,Field2,Field3,Field4&$expand=File","true","utf-8")}

Thanks for the response @wilsonshamim, using base64 the request was successful but the operators were not applied.

However, after some trial and error I did manage to get it working with the correct combination of concat function and encoding:

https://mysite.sharepoint.com/sites/site-name/_api/Web/Lists/GetByTitle('List%20Name')/Items?${str:concat("$filter=(FSObjType%20eq%200)%20and%20(FieldName%20ne%20null)","&$expand=File")}

 

Hopefully this can help others and thank you for your help.

Reply