documentation for #XPRIM_JsonWriter (WriteBase64StringFromFile ) or #PRIM_JSON.Writer (WriteBase64)
Posted: Mon Apr 18, 2022 8:23 pm
Hi,
Good day!
I would like to ask if there is a documentation available for #XPRIM_JsonWriter or #PRIM_JSON.Writer ?
I am trying to build a JSON Request and use the WriteBase64StringFromFile but I think it may have a limitation when it comes to size of the file.
It works for small files but when the file is around around 60+KB or larger, it fails. [or maybe I am not using it correctly]
Below is a sample on how I use it:
I need to use the RequestJson as content for my post request.
I also tried using #PRIM_JSON.Writer 's WrieBase64 like this:
But I think Writebase64 only encodes to Base64 the path of the file and not the file content.[or I may be mistaken]
A link to a documentation for #XPRIM_JsonWriter (WriteBase64StringFromFile ) or #PRIM_JSON.Writer (WriteBase64) or any info/help would be much appreciated.
Or suggestions on how to use it or sample code would also be nice.
Thank you in advance,
Faridah
Good day!
I would like to ask if there is a documentation available for #XPRIM_JsonWriter or #PRIM_JSON.Writer ?
I am trying to build a JSON Request and use the WriteBase64StringFromFile but I think it may have a limitation when it comes to size of the file.
It works for small files but when the file is around around 60+KB or larger, it fails. [or maybe I am not using it correctly]
Below is a sample on how I use it:
Code: Select all
Define_Com Class(#XPRIM_JsonWriter) Name(#JsonWriter)
Define_Map For(*INPUT) Class(#XPRIM_Json) Name(#RequestJson)
Define_Com Class(#XPRIM_HttpRequest) Name(#Request)
Define_Com Class(#XPRIM_UriBuilder) Name(#RequestUrl)
...
#JsonWriter.BeginObject Name('documentDetails')
#JsonWriter.WriteString Name('name') Value('TestFile_20220414')
#JsonWriter.WriteBase64StringFromFile Name('documentContent') Filepath('c:/temp/test/TestFile_20220414.pdf')
#JsonWriter.EndObject
...
#RequestJson.ParseString String(#JsonWriter.AsString)
#Request.Clear
#RequestUrl.Clear
#Request.Content.AddJson Value(#RequestJson)
...
#Request.DoPost Url(#RequestUrl)I need to use the RequestJson as content for my post request.
I also tried using #PRIM_JSON.Writer 's WrieBase64 like this:
Code: Select all
Define_Com Class(#PRIM_IOC.StringWriter) Name(#StringWriter)
Define_Com Class(#PRIM_JSON.Writer) Name(#Writer) Textwriter(#StringWriter)
Define_Com Class(#XPRIM_File) Name(#OutFile)
#OutFile.SetPath Filepath('c:/temp/test/Todo.txt')
#Writer.WriteBase64 Membername('documentContent') Value(#OutFile)A link to a documentation for #XPRIM_JsonWriter (WriteBase64StringFromFile ) or #PRIM_JSON.Writer (WriteBase64) or any info/help would be much appreciated.
Or suggestions on how to use it or sample code would also be nice.
Thank you in advance,
Faridah