Executing GP service for a batch geocode process using JSON - Task parameter properties (REST)

3838
4
06-02-2015 06:52 AM
ErnestoCarreras3
Occasional Contributor

Any help will be appreciated. I am trying to make this work but have not succeeded yet, though I was able to host the .CSV table in an app server that has access to the GIS site and the process executed fine. Now, I want to change the parameter to be a GPRecordSet to replicate my table definitions but have not succeeded. I noticed the following Help reference: http://resources.arcgis.com/en/help/main/10.2/index.html#/Task_parameter_properties_REST/00570000007...

For GPRecordSet and GPFeatureRecordSetLayer parameters, if you have a large number of records and features, you can store the JSON structure in a file and provide the URL as an input. For example, { "url" : "http://myserver/myfeatures/afile.txt"}. The text file must have featureset or recordset in JSON format.

I think this also destroys my intention on trying to use the JSON format since my table definition can have thousands or records. Any suggestions?

0 Kudos
4 Replies
KevinHibma
Esri Regular Contributor

What exactly is the question?

You've talked about how parameters work in regards to a GPRecordSet, but what exactly is your problem or where are you stuck?

0 Kudos
ErnestoCarreras
New Contributor

I would like to be able to call the service from code and directly provide a GPRecordSet rather than create some other process that calls jobs on files.

I would like to know the correct input parameters to the batch process service call. The example GPRecordSet JSON is invalid on the help page given above.  On our server the submit job for our batch address geocode expects an Input_Table of GPDataFile.  What would you suggest we do to enable this functionality?

0 Kudos
KevinHibma
Esri Regular Contributor

Without seeing your model or script, it sounds like the input parameter to it is a file (GPDataFile as you reference).

Before publishing you'd need to setup the model or script with an input parameter of TABLE.

Take special note though, that when publishing the result as a service, depending how you provided input to the parameter it may make a best guess and try to change it. Ensure that the input to your service stays as a "user defined value" (it'll show the schema of the table in the service editor for you to confirm). Once published, it'll be a GPRecordSet.

Getting the required input JSON correct can be troublesome.

If you go into ArcMap and open the Python window, you can get JSON code from your CSV by putting these lines:

rs = arcpy.RecordSet()

rs.load("c:/path/to/file.csv")

rs.JSON

ErnestoCarreras
New Contributor

Kevin Hibma​ I changed the variable in the model to Record Set as described in A quick tour of using Feature Set and Record Set. Then published te model and it worked as expected. Thanks for your info as it was helpful.

0 Kudos