You are right, you have to create the properties before to use %FindDocuments...BUT...it doesn't work for arrays of data. I've found this answer to a similar question:

https://community.intersystems.com/post/how-query-data-docdb-through-pyt...

I was testing the behaviour with this example:

  DO db.%CreateProperty("type","%String","$.PhoneNumber.type")
    

  SET dynAbObj = {
   "FullName":"John Smith",
   "FirstName":"John",
   "Address":{
              "street":"101 Main Street",
              "city":"Mapleville",
              "state":"NY",
              "postal code":10234
             },
   "PhoneNumber":
              [
               {"type":"home","number":"212-456-9876"},
               {"type":"cell","number":"401-123-4567"},
               {"type":"work","number":"212-444-5000"}
              ]
  }
  $$$TRACE(dynAbObj.%ToJSON())
  SET jstring = dynAbObj.%ToJSON() // dynamic abstract object to JSON string
  DO db.%FromJSON(jstring)   // JSON string inserted into document database
  $$$TRACE(db.%FindDocuments(["type","cell","="]).%ToJSON())
  $$$TRACE(db.%FindDocuments(["type","home","="]).%ToJSON())

This is the answer for the first search:

{"sqlcode":100,"message":null,"content":[]}

And this is the answer for the second search:

{"sqlcode":100,"message":null,"content":[{"%Doc":"{\"FullName\":\"John Smith\",\"FirstName\":\"John\",\"Address\":{\"street\":\"101 Main Street\",\"city\":\"Mapleville\",\"state\":\"NY\",\"postal code\":10234},\"PhoneNumber\":[{\"type\":\"home\",\"number\":\"212-456-9876\"},{\"type\":\"cell\",\"number\":\"401-123-4567\"},{\"type\":\"work\",\"number\":\"212-444-5000\"}]}","%DocumentId":"1","%LastModified":"2023-09-18 10:13:30.694"}]}

As you can see, it only works fine for the first value of the array, the definition of the property doesn't allow to define an array of values.

To receive REST call directly into a Business Service is not the most recommended because you can't apply any kind of access restriction to the service. What I always recommend is to create a web application managed by a class that extends from %CSP.Rest and resend the JSON received to the Business Service.

You can see an example on this article:

https://community.intersystems.com/post/creating-rest-service-iris

Well, if your IRIS doesn't support Embedded Python you can do the following (if you are using a Linux Server):

  1. Install some application like ImageMagick in your server
  2. From your Business Operation use $ZF(-100) function to execute in the server the magick command to convert the PDG to JPG, something like:
    $ZF(-100,"","magick","\usr\image.pdf","\usr\image.jpg") 
  3. Maybe it takes some time to finish, you can wait to the end of the execution or just create a business service to get all the new pdf files.