Create or update a form

put

/rest/ofscMetadata/v1/forms/{label}

This operation creates a new form or updates an existing form.

The Translations parameter is required for a new form. All the translations are replaced by the structure in the request. Also, the Name attribute in the translation structure is required for English and cannot be empty.

Configuration: You must grant permissions to the Metadata API and must set Read-Write access to the Forms entity in the Configuration, Applications (API permissions) screen.

Request

Path Parameters
  • Minimum Length: 1
    Maximum Length: 40
    The label of the form.
Body ()
This section describes the request body parameters for this operation.
Root Schema : Form Body
Type: object
Title: Form Body
The schema of the request body object for this operation.
Show Source
  • Translations
    Title: Translations
    The list of translations associated with the name of the form. The list is only returned if the language parameter is not specified in the request.
    • The translations parameter is required for creating a form, but the parameter is optional for updating a form.
    • If the parameter is not specified, then the translations in the response are not changed.
    • If the parameter is present in the request, then the 'name' attribute is required for English and the attribute cannot be empty.
    • All the translations for the name of the form are replaced in the request.
Match All
Show Source
Nested Schema : Translations
Type: array
Title: Translations
The list of translations associated with the name of the form. The list is only returned if the language parameter is not specified in the request.
  • The translations parameter is required for creating a form, but the parameter is optional for updating a form.
  • If the parameter is not specified, then the translations in the response are not changed.
  • If the parameter is present in the request, then the 'name' attribute is required for English and the attribute cannot be empty.
  • All the translations for the name of the form are replaced in the request.
Show Source
Nested Schema : Form Content
Type: object
Title: Form Content
The specified form content in JSON string format.
Show Source
  • Title: Content
    The JSON string that describes the form content.
Nested Schema : FormBodyTranslationParam
Type: object
Show Source
Back to Top

Response

Supported Media Types

200 Response

This section describes the 200 status response for this operation.
Body ()
Root Schema : Form Details with Stats
Type: object
Title: Form Details with Stats
The list of errors and warnings that occured while creating or updating the form.
Show Source
Match All
Show Source
Nested Schema : Warnings
Type: array
Title: Warnings
The list of warnings that occurred while saving the form.
Show Source
Nested Schema : Form Details
Type: object
Title: Form Details
The schema of the response body object for this operation.
Match All
Show Source
  • Form
    Title: Form
    The form entity in the Oracle Field Service Cloud application.
  • Form Content
    Title: Form Content
    The specified form content in JSON string format.
Nested Schema : Form
Type: object
Title: Form
The form entity in the Oracle Field Service Cloud application.
Show Source
  • Title: Label
    Minimum Length: 1
    Maximum Length: 40
    The label of the form.
  • Title: Name
    Minimum Length: 1
    Maximum Length: 255
    The translation of the name of the form to the specified language.
  • Translations
    Title: Translations
    The list of associated translations that is returned for the name of the form. The list is only returned if the language parameter is not specified in the request.
Nested Schema : Form Content
Type: object
Title: Form Content
The specified form content in JSON string format.
Show Source
  • Title: Content
    The JSON string that describes the form content.
Nested Schema : Translations
Type: array
Title: Translations
The list of associated translations that is returned for the name of the form. The list is only returned if the language parameter is not specified in the request.
Show Source
Nested Schema : Translation
Type: object
Show Source
  • This field contains language code of a text translation, it conatains two characters length code in responses (e.g. 'en', 'es') but can be used in requests as extended ISO code (e.g. 'en-US') as well as old two character format.
  • This field is used only in responses and returns ISO language code (e.g. 'en-US'). This field is ignored in the requests (use 'language' instead)

201 Response

This section describes the 201 status response for this operation.
Body ()
Root Schema : Form Details with Stats
Type: object
Title: Form Details with Stats
The list of errors and warnings that occured while creating or updating the form.
Show Source
Match All
Show Source
Nested Schema : Warnings
Type: array
Title: Warnings
The list of warnings that occurred while saving the form.
Show Source
Nested Schema : Form Details
Type: object
Title: Form Details
The schema of the response body object for this operation.
Match All
Show Source
  • Form
    Title: Form
    The form entity in the Oracle Field Service Cloud application.
  • Form Content
    Title: Form Content
    The specified form content in JSON string format.
Nested Schema : Form
Type: object
Title: Form
The form entity in the Oracle Field Service Cloud application.
Show Source
  • Title: Label
    Minimum Length: 1
    Maximum Length: 40
    The label of the form.
  • Title: Name
    Minimum Length: 1
    Maximum Length: 255
    The translation of the name of the form to the specified language.
  • Translations
    Title: Translations
    The list of associated translations that is returned for the name of the form. The list is only returned if the language parameter is not specified in the request.
Nested Schema : Form Content
Type: object
Title: Form Content
The specified form content in JSON string format.
Show Source
  • Title: Content
    The JSON string that describes the form content.
Nested Schema : Translations
Type: array
Title: Translations
The list of associated translations that is returned for the name of the form. The list is only returned if the language parameter is not specified in the request.
Show Source
Nested Schema : Translation
Type: object
Show Source
  • This field contains language code of a text translation, it conatains two characters length code in responses (e.g. 'en', 'es') but can be used in requests as extended ISO code (e.g. 'en-US') as well as old two character format.
  • This field is used only in responses and returns ISO language code (e.g. 'en-US'). This field is ignored in the requests (use 'language' instead)

Default Response

This section describes the default error response for this operation.
Body ()
Root Schema : Error
Type: object
Error response
Show Source
Back to Top

Examples

Example 1

The following example shows how to create a new form with content by submitting a PUT request on the REST resource using cURL.

cURL Command Example

The following shows an example of the cURL command.

curl -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' -H 'Accept: application/json' 'https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/forms/hit_inv' -d '{ "translations": {"language": "en-US", "name": "Hit Inv"}, {"language": "es", "name": "Hit EQ"}],"content": "{\"submit\":{\"visibility\":[]},\"items\":[{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"srtype\",\"name\":{\"en\":\"Request type\",\"es\":\"Tipo de solicitud\",\"fr\":\"Type de demande\",\"de\":\"Anforderungstyp\",\"br\":\"Tipo de Solicita\\u00e7\\u00e3o\",\"ja\":\"\\u8981\\u6c42\\u30bf\\u30a4\\u30d7\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":[\"1\",\"1\"]}]},{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"hit_type\",\"name\":{\"en\":\"Hit Type\",\"es\":\"Hit Type\",\"fr\":\"Hit Type\",\"de\":\"Hit Type\",\"br\":\"Hit Tipo\",\"ja\":\"Hit Type\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":\"*\"}]},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"access_hours\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"end_time\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}}]}]}]}]}"}'

Response Header Example

The following shows an example of the response header.

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Jan 2018 12:28:18 GMT
Content-Type: application/json; charset=utf-8
Connection: close

Response Body Example

The following shows an example of the response body in JSON format.

{
    "label": "hit_inv",
    "name": "Hit Inv",
    "translations": [
        {
            "language": "en",
            "name": "Hit Inv",
            "languageISO": "en-US"
        },
        {
            "language": "es",
            "name": "Hit EQ",
            "languageISO": "es-ES"
        }
    ],
    "content": "{\"submit\":{\"visibility\":[]},\"items\":[{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"srtype\",\"name\":{\"en\":\"Request type\",\"es\":\"Tipo de solicitud\",\"fr\":\"Type de demande\",\"de\":\"Anforderungstyp\",\"br\":\"Tipo de Solicita\\u00e7\\u00e3o\",\"ja\":\"\\u8981\\u6c42\\u30bf\\u30a4\\u30d7\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":[\"1\",\"1\"]}]},{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"hit_type\",\"name\":{\"en\":\"Hit Type\",\"es\":\"Hit Type\",\"fr\":\"Hit Type\",\"de\":\"Hit Type\",\"br\":\"Hit Tipo\",\"ja\":\"Hit Type\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":\"*\"}]},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"access_hours\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"end_time\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}}]}]}]}]}",
    "links": [
        {
            "rel": "canonical",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/forms/hit_inv"
        },
        {
            "rel": "describedby",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/forms"
        }
    ]
}

Example 2

The following example shows error in form content by submitting a PUT request on the REST resource using cURL.

cURL Command Example

The following shows an example of the cURL command.

curl -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' -H 'Accept: application/json' 'https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/forms/hit_inv' -d '{ "translations": [{"language": "en-US", "name": "Hit Inv"}, {"language": "es", "name": "Hit EQ"}], "content": "{\"submit\":{\"visibility\":[]},\"items\":[{\"type\":\"sectison\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"srtype\",\"name\":{\"en\":\"Request type\",\"es\":\"Tipo de solicitud\",\"fr\":\"Type de demande\",\"de\":\"Anforderungstyp\",\"br\":\"Tipo de Solicita\\u00e7\\u00e3o\",\"ja\":\"\\u8981\\u6c42\\u30bf\\u30a4\\u30d7\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":[\"1\",\"1\"]}]},{\"type\":\"field\",\"dataBinding\":\"serviceRequestField\",\"label\":\"hit_type\",\"name\":{\"en\":\"Hit Type\",\"es\":\"Hit Type\",\"fr\":\"Hit Type\",\"de\":\"Hit Type\",\"br\":\"Hit Tipo\",\"ja\":\"Hit Type\"},\"defaultVisibility\":\"mandatory\",\"valueVisibility\":[{\"values\":\"*\"}]},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"access_hours\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}},{\"type\":\"section\",\"defaultVisibility\":\"readWrite\",\"items\":[{\"type\":\"field\",\"dataBinding\":\"activityField\",\"label\":\"end_time\",\"defaultVisibility\":\"readWrite\",\"defaultValue\":\"v1#\",\"valueValidation\":{\"rule\":\"v1#\",\"errorMessage\":[]}}]}]}]}]}"}'

Response Header Example

The following shows an example of the response header.

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Jan 2018 12:28:18 GMT
Content-Type: application/json; charset=utf-8
Connection: close

Response Body Example

The following shows an example of the response body in JSON format.

{
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
    "title": "Bad Request",
    "status": "400",
    "detail": "Unsupported type \"sectison\" is provided for document node."
}
Back to Top