Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs additions on enabling feature access and importing SLAP #28

Merged
merged 3 commits into from
Oct 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/importing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Importing SLAP into your existing code/module/project

It is also possible to import SLAP into your own process. Below we are
globbing a directory for MXDs and sending them all to SLAP for
publishing. This scenario works for when you have a folder structure full
of production MXDs and a SLAP configuration file with all the MXDs in it
and you want to perhaps replicate your services in another environment.

```
from slap import publisher
import glob
import os

username = "user"
password = "pass"
slap_config = "path_to_confg"
# Get list of input MXDs
inputs = glob.glob(os.path.join("path_to_mxds", "*.mxd"))

pub = publisher.Publisher()

print "Loading config..."
pub.load_config(slap_config)
pub.create_server_connection_file(username, password)
pub.init_api(
ags_url=pub.config['agsUrl'],
token_url=pub.config['tokenUrl'],
portal_url=pub.config['portalUrl'] if 'portalUrl' in pub.config else None,
certs=pub.config['certs'] if 'certs' in pub.config else True,
username=username,
password=password
)

for i in inputs:
pub.publish_input(i)
```
61 changes: 61 additions & 0 deletions docs/publishfeatureservice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Enabling feature access in a map service

To enable feature access on a map service, you must enable the `FeatureServer`
extension in the service `json` parameter - the easiet way to get the
`FeatureSerer` JSON is to go the REST Admin endpoint for a service with
feature access enabled, copy it, and modify it for your needs.


```` javascript
{
"input": "D:\\path-to\\my.mxd",
"output": "output/",
"serviceName": "My Service",
"initialState": "STOPPED",
"serverType": "ARCGIS_SERVER",
"copyDataToServer": "False",
"folderName": "Hydrants",
"summary": "",
"workspaces": [{
"old": {
"path": "\\\\old-path\conn.sde",
"type": "SDE_WORKSPACE"
},
"new": {
"path": "D:\\new-path\conn.sde",
"type": "SDE_WORKSPACE"
}
}],
"json": {
"extensions": [{
"typeName": "FeatureServer",
"capabilities": "Create,Delete,Query,Update,Uploads,Editing",
"enabled": "true",
"maxUploadFileSize": 0,
"allowedUploadFileTypes": "",
"properties": {
"creatorPresent": "true",
"dataInGdb": "true",
"xssPreventionEnabled": "true",
"allowGeometryUpdates": "true",
"versionedData": "true",
"syncVersionCreationRule": "versionPerDownloadedMap",
"maxRecordCount": "1000",
"allowOthersToQuery": "true",
"syncEnabled": "false",
"editorTrackingTimeZoneID": "UTC",
"enableZDefaults": "false",
"realm": "",
"allowOthersToDelete": "false",
"allowTrueCurvesUpdates": "false",
"datasetInspected": "true",
"editorTrackingRespectsDayLightSavingTime": "false",
"zDefaultValue": "0",
"enableOwnershipBasedAccessControl": "false",
"editorTrackingTimeInUTC": "true",
"allowOthersToUpdate": "false"
}
}]
}
}
````
13 changes: 11 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ An example configuration file might look like below. *Note:* The comments would
```

## Specifying service parameters
Service properties can be specified at multiple levels in the file; the most specific property will be used (i.e., service level, then type level, then global). This allows for a minimum of
configuration, while also allowing for service parameters to vary. Note that the `json` parameter is identical what's specified in ESRI's [REST API](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Create_Service/02r3000001tr000000/)
Service properties can be specified at multiple levels in the file; the most
specific property will be used (i.e., service level, then type level, then
global). This allows for a minimum of configuration, while also allowing
for service parameters to vary. Note that the `json` parameter is identical
what's specified in ESRI's [REST API](http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Create_Service/02r3000001tr000000/).
An example of the utilizing the `json` parameter is [enabling feature access](docs/publishfeatureservice.md)
on a service.

## Example setup

Expand Down Expand Up @@ -187,6 +192,10 @@ To republish all the services using the production config file, we can do
slap --config prod.json --username <myProductionUsername> --password <myProductionPassword> --all
```

## Integrating SLAP into another process

You can also [import SLAP](docs/importing.md) into a module and call it.

## Replacing workspace paths
To use separate credentials/data sources for different environments, you can supply an array of find/replace values under the `workspaces` key. If this key is found,
the script will replace each `old` workspace path (i.e., path to a connection file) with the `new` value.
Expand Down