Add Report

URL:
https://<services-url>/<mission_service_id>/addReport
Methods:
POST
Required Capability:
Administrator
Version Introduced:
11.0

Description

This operation adds a report to the associated mission. A mission report is used by clients to submit relevant information to the mission and is represented in the portal by a Mission Report portal item and an associated hosted feature layer. The feature layer can be used by clients to submit new reports and to edit and view existing reports..

Request parameters

ParameterDetails

title

(Required)

String. The title of the report.

source

(Required)

String. Indicates the source submitting the reports. Set to user if a user will be submitting these reports, set to sensor if sensors will be used to submit reports instead.

If source is sensor sensorInfo is required.

serviceName

(Required)

String. Used to create the supporting service URL(s). This value cannot be longer than 87 characters and cannot contain the following values:

# ,$ , % , ^ ,* , = , ` ,{ ,} ,[ ,] ,, ,{space} ,: ,* , ? , " ,< ,> ,| ,\ , / , +

description

(Optional)

String. A description of the report.

tags

(Optional)

A comma-separated list of strings. Used to add tags to the report.

questions

(Optional)

JSON Array. If an empty array is passed, the request is rejected. Used to represent the desired questions and their fields. Question types are based on Survey123 question type fields. See below for further details.

Available question types: Single Line Text, Single Choice, Number, Multiline Text, Dropdown, and Date/Time.

If questions is not set, the following default questions are created for the report.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[
        {
            "isRequired": true,
            "fieldName": "subject",
            "name": "subject",
            "description": "Provide a short topical subject matter of this report.",
            "id": "field_0",
            "position": 0,
            "label": "Subject:",
            "type": "esriQuestionTypeText",
            "validation": {"valueRange": {
                "max": 50,
                "isEnabled": true
            }}
        },
        {
            "isRequired": false,
            "fieldName": "notes",
            "name": "Notes",
            "description": "Provide a summary of the events, observations or the information being reported.",
            "id": "field_1",
            "position": 1,
            "label": "Notes:",
            "type": "esriQuestionTypeTextArea",
            "validation": {"valueRange": {
                "max": 500,
                "isEnabled": true
            }}
        }
    ]

displayField

(Optional)

String. The name of the report feature layer's display field. Normally this is the field name of one of the report questions. If absent, the report feature layer's display field will be the first question's field name.

drawingInfo

(Optional)

JSON Object. Defines the report feature layer's drawing info, including a feature renderer. See drawingInfo for details.

locale

(Optional)

String. The locale used to generate the report. Must be a valid IETF BCP 47 language tag. Defaults to en

shareAsTemplate

(Optional)

Boolean. Shares the report as a template.

hasAttachments

(Optional)

Boolean. Enables attachments on the reports layer. Enable this to allow clients to upload images when submitting reports.

sensorInfo

(Required when source is sensor)

JSON Object. Defines the sensor that will generate the report. The sensor integration must be set to enabled , must contain a valid sensorId and at least one valid triggers property.

Example:

Example sensorInfo parameter:

Use dark colors for code blocksCopy
1
2
3
4
{
	  sensorId: "Flic2",
	  triggers: ["double-press","single-press"]
	}

onReceiveAction

(Optional)

JSON Object. Defines the client action when a report is submitted.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
{
		  "arcgisMissionManager": {
			"map": ["zoomToFeature", "showFeaturePopup", "animateFeatureSymbol"],
			"device": ["alert.mp4"]
		  },
		  "arcgisMissionResponder": {
			"map": ["zoomToFeature"],
			"device": ["vibrate-3", "notification"]
		  }
		}

f

The response format. The default response format is html .

Values: html | json | pjson

Question Properties

Users answer questions while submitting reports. Use the questions parameter to define questions for a new report. Each question has the properties in the following table.

AttributeValue(s)

id

String. The desired id of the question.

position

Integer. The desired position within the questions fields you wish this question to appear.

fieldName

Required. String. The desired field name for the question in the feature layer.

name

String. The name of the question.

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
...
"name": "damage_level_dropdown",
"type": "esriQuestionTypeDropdown",
"label": "Pick one from this dropdown list",
...

type

Required. String. The question type.

Available types: esriQuestionTypeText , esriQuestionTypeTextArea , esriQuestionTypeSingleChoice , esriQuestionTypeDropdown , or esriQuestionTypeDateTime .

label

String. A user facing label for the question.

description

String. A description of the question.

isRequired

Boolean. Determines whether the question requires an answer when submitting a report.

defaultValue

The default value of the question when a user chooses to submit the report. The type of value provided should match the question's answer.

choices

Required when type is esriQuestionTypeSingleChoice or esriQuestionTypeDropdown

Contains a JSON Object items that contains an array of label , value , and position .

Example:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"choices": {
            "items": [
                {
                    "label": "This is option 1",
                    "value": "single_choice_1",
                    "position": 0
                },
                {
                    "label": "This is option 2",
                    "value": "single_choice_2",
                    "position": 1
                }
            ]
        }

Example User Report Request

Below is a sample request URL for the reports/add operation:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
POST /webadaptor/rest/missions/<misison_id>/reports/add HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

title=Damage Report
description=Use this report to document damage in the area
tags=Damage Report, Alpha, Bravo, Mission
questions=[
        {
            "isRequired": true,
            "fieldName": "damage_description",
            "defaultValue": "",
            "name": "multi_line_text",
            "description": "Multiline Text Field used to describe the damage",
            "id": "field_2",
            "position": 1,
            "label": "Describe the damage",
            "type": "esriQuestionTypeTextArea"
        },
        {
            "isRequired": false,
            "fieldName": "damage_level",
            "defaultValue": "single_choice_1",
            "name": "single_choice",
            "description": "Select a level of damage.",
            "id": "field_3",
            "position": 2,
            "label": "Label for selecting a level of damage",
            "type": "esriQuestionTypeSingleChoice",
            "choices": {"items": [
                {
                    "label": "This is option 1",
                    "position": 0,
                    "value": "single_choice_1"
                },
                {
                    "label": "This is option 2",
                    "position": 1,
                    "value": "single_choice_2"
                }
            ]}
        },
        {
            "isRequired": false,
            "fieldName": "date_time_occured",
            "name": "date_time",
            "description": "Select a Date and Time when the damage approx. occured",
            "id": "field_4",
            "position": 3,
            "label": "Date and Time damage occured",
            "type": "esriQuestionTypeDateTime"
        },
        {
            "isRequired": false,
            "fieldName": "team_reported",
            "defaultValue": "",
            "name": "dropdown",
            "description": "Select a team that reported the damage",
            "id": "field_5",
            "position": 4,
            "label": "Reported by team:",
            "type": "esriQuestionTypeDropdown",
            "choices": {"items": [
                {
                    "label": "Team Alpha",
                    "position": 0,
                    "value": "dropdown_choice_1"
                },
                {
                    "label": "Team Bravo",
                    "position": 1,
                    "value": "dropdown_choice_2"
                }
            ]}
        }
    ]
displayField=damage_level
drawingInfo={"renderer":{"type":"simple","symbol":{"color":[0,0,128,128],"size":15,"angle":0,"xoffset":0,"yoffset":0,"type":"esriSMS","style":"esriSMSCircle","outline":{"color":[0,0,128,255],"width":0.99975,"type":"esriSLS","style":"esriSLSSolid"}}}}
locale=en
hasAttachments=true
shareAsTemplate=true

Example Sensor Report Request

Below is a sample request URL for the reports/add operation:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
POST /webadaptor/rest/missions/<misison_id>/reports/add HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

title=Sensor Report
description=Use this for creating reports with sensors
tags=Sensor Report, Alpha, Bravo, Mission
questions=[
    {
        "id": "device_id",
        "position": 0,
        "fieldName": "single_line_text_1",
        "name": "single_line_text",
        "type": "esriQuestionTypeText",
        "label": "Device Id",
        "description": "",
        "isRequired": true,
        "defaultValue": "{deviceId}",
        "validation": {
            "valueRange": {
                "isEnabled": true,
                "min": 0,
                "max": 200
            }
        }
    },
    {
        "id": "location",
        "position": 1,
        "fieldName": "single_line_text_2",
        "name": "single_line_text",
        "type": "esriQuestionTypeText",
        "label": "Location",
        "description": "",
        "isRequired": true,
        "defaultValue": "{XY}",
        "validation": {
            "valueRange": {
                "isEnabled": true,
                "min": 0,
                "max": 200
            }
        }
    },
    {
        "id": "default_message",
        "position": 2,
        "fieldName": "single_line_text_3",
        "name": "single_line_text",
        "type": "esriQuestionTypeText",
        "label": "Message",
        "description": "",
        "isRequired": true,
        "defaultValue": "A sensor report has been submitted",
        "validation": {
            "valueRange": {
                "isEnabled": true,
                "min": 0,
                "max": 200
            }
        }
    },
    {
        "id": "user_fullname",
        "position": 3,
        "fieldName": "single_line_text_4",
        "name": "single_line_text",
        "type": "esriQuestionTypeText",
        "label": "Name of Sender",
        "description": "",
        "isRequired": true,
        "defaultValue": "{userFullname}",
        "validation": {
            "valueRange": {
                "isEnabled": true,
                "min": 0,
                "max": 200
            }
        }
    },
    {
        "id": "date",
        "position": 4,
        "fieldName": "date_time_5",
        "name": "date_time",
        "type": "esriQuestionTypeDateTime",
        "label": "Date and Time",
        "description": "Select a Date and Time",
        "isRequired": true,
        "defaultValue": "{dateNow}",
        "validation": {
            "valueRange": {
                "isEnabled": false
            }
        }
    }
]
drawingInfo={
    "transparency": 0,
    "labelingInfo": null,
    "renderer": {
        "type": "simple",
        "symbol": {
            "type": "esriSMS",
            "color": [
                255,
                76,
                25,
                255
            ],
            "angle": 0,
            "xoffset": 0,
            "yoffset": 0,
            "size": 12,
            "style": "esriSMSDiamond",
            "outline": {
                "type": "esriSLS",
                "color": [
                    0,
                    0,
                    0,
                    255
                ],
                "width": 0.375,
                "style": "esriSLSSolid"
            }
        }
    }
}
onReceiveAction={
    "arcgisMissionManager": {
        "map": [
            "zoomToFeature"
        ],
        "device": [
            {
                "type": "action",
                "name": "notification"
            },
            {
                "type": "sound",
                "name": "ring",
                "loop": false,
                "file": null
            }
        ]
    },
    "arcgisMissionResponder": {
        "map": [],
        "device": []
    }
}
f=json

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
{
  "reportId": "a4d4228234af47978f787e75e7691498",
  "success": true,
  "templateId": "2fc4192579224368b2ac87d492392f66"
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.