so I could choose the table of the geopackage in order to do some batch proccessing with a loop on the biotopes.
Any idea ?
Thanks.
Best answer by arnovananrooij
I have some python code that uploads a file to FME Server and then runs a webhook
filename = outfile
_file = os.path.basename(filename)
token = ""
fmehndlr = FMEHandler.FMEHandlerClass()
fmehndlr.filename = _file
## set token
fmehndlr.token = token
## set upload location
fmehndlr.upurl = "http://000.00.0.103:8080/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_TEMP/filesys"
#### set parameter values
rowtype = name.replace(" ",'%20')
projectname = project.replace(" ",'%20')
projectnumber = projectnum.replace(" ",'%20')
scale = "1000"
dwgname = _file.replace('.gdb',"").replace('.zip',"")+".dwg"
dwgpath = os.path.join(projectfolder,dwgname)
## url for webhook with parameters in it, you have toset this before upload if used with the AP41 flag
fmehndlr.runurl = f"http://000.00.0:8080/fmedatastreaming/PlatFactory/conchoEasementCenterline.fmw?TEMPLATE=%24(FME_MF_DIR)CONCHO_TEMPLATE_CENTERLINE_EASEMENT.dwg&SCALE={scale}&SourceDataset_FILEGDB=%24(FME_SHAREDRESOURCE_TEMP)%2F{_file}&SPACE=PAGE%202%20OF%202&WIDTH={str(width)}&EASEMENT_TYPE={rowtype}&PROJECT_NAME={projectname}&PROJECT_NUMBER={projectnumber}&token=token"
### upload and print response status
resp = fmehndlr.upload(filename)
arcpy.AddMessage(resp.status_code)
if resp.status_code==201:
## run webhook and catch response
resp = fmehndlr.runwebhook()
arcpy.AddMessage(resp.status_code)
if resp.status_code==200:
fmehndlr.savefilestream(dwgpath,resp)
This code works fine on my machine but when I run it from another computer, after the file is uploaded to FME Server the webhook fails. This is what I don't understand, if the file is uploaded successfully and returns status 201 why is FME then refusing the webhook and returning status 401?
I have some python code that uploads a file to FME Server and then runs a webhook
filename = outfile
_file = os.path.basename(filename)
token = ""
fmehndlr = FMEHandler.FMEHandlerClass()
fmehndlr.filename = _file
## set token
fmehndlr.token = token
## set upload location
fmehndlr.upurl = "http://000.00.0.103:8080/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_TEMP/filesys"
#### set parameter values
rowtype = name.replace(" ",'%20')
projectname = project.replace(" ",'%20')
projectnumber = projectnum.replace(" ",'%20')
scale = "1000"
dwgname = _file.replace('.gdb',"").replace('.zip',"")+".dwg"
dwgpath = os.path.join(projectfolder,dwgname)
## url for webhook with parameters in it, you have toset this before upload if used with the AP41 flag
fmehndlr.runurl = f"http://000.00.0:8080/fmedatastreaming/PlatFactory/conchoEasementCenterline.fmw?TEMPLATE=%24(FME_MF_DIR)CONCHO_TEMPLATE_CENTERLINE_EASEMENT.dwg&SCALE={scale}&SourceDataset_FILEGDB=%24(FME_SHAREDRESOURCE_TEMP)%2F{_file}&SPACE=PAGE%202%20OF%202&WIDTH={str(width)}&EASEMENT_TYPE={rowtype}&PROJECT_NAME={projectname}&PROJECT_NUMBER={projectnumber}&token=token"
### upload and print response status
resp = fmehndlr.upload(filename)
arcpy.AddMessage(resp.status_code)
if resp.status_code==201:
## run webhook and catch response
resp = fmehndlr.runwebhook()
arcpy.AddMessage(resp.status_code)
if resp.status_code==200:
fmehndlr.savefilestream(dwgpath,resp)
This code works fine on my machine but when I run it from another computer, after the file is uploaded to FME Server the webhook fails. This is what I don't understand, if the file is uploaded successfully and returns status 201 why is FME then refusing the webhook and returning status 401?
On the command line you can use any published parameter. By default only the Dataset of the source and the destionation is published. If you choose single merged feature type then also 'feature type to read' is published as a parameter.
So when you add a geopackage reader
You choose one table as an example
Then choose 'Single Merged Feature Type'
In the navigator you will see 2 published parameters.
This means you can use them both in a command line engine:
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.