# Get Form By ID GET http://localhost:5000/myinstance1/forms/{formId} Form with the requested ID should be returned from this API. Anticipated load – Moveworks may call this endpoint a few times every 24 hours. This API is primarily for sanity checks and debugging. Since ingestion happens once every 24 hours, we might want to verify if form submission failures are due to deviations between the local and remote versions. Reference: https://docs.moveworks.com/api-reference/forms-gateway/smart-forms/get-form-by-id ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get Form By ID version: endpoint_smartForms.getFormById paths: /forms/{formId}: get: operationId: get-form-by-id summary: Get Form By ID description: >- Form with the requested ID should be returned from this API. Anticipated load – Moveworks may call this endpoint a few times every 24 hours. This API is primarily for sanity checks and debugging. Since ingestion happens once every 24 hours, we might want to verify if form submission failures are due to deviations between the local and remote versions. tags: - - subpackage_smartForms parameters: - name: formId in: path description: ID of form to return required: true schema: type: string - name: Authorization in: header description: >- Bearer authentication of the form `Bearer `, where token is your auth token. required: true schema: type: string responses: '200': description: A single form content: application/json: schema: $ref: '#/components/schemas/Form' components: schemas: FormDomain: type: string enum: - value: IT - value: HR FieldType: type: string enum: - value: LABEL - value: SINGLE_OPTION_PICKER - value: MULTI_OPTION_PICKER - value: SINGLE_USER_OPTION_PICKER - value: MULTI_USER_OPTION_PICKER - value: SINGLE_LINE_TEXT - value: MULTI_LINE_TEXT - value: CHECKBOX - value: DATE_PICKER - value: DATETIME_PICKER Option: type: object properties: label: type: string description: >- The display value for this option. This will be displayed to the end user. value: type: string description: >- The response value for this option. This will be used as the field value during form submission. required: - label - value Field: type: object properties: name: type: string description: >- Unique name for the field in the form. Will be used as the key (in a key-value pair) during form submission. label: type: string description: Label for the field. This will be displayed to the end user. placeholder: type: string description: >- Placeholder text to be shown in the field. This will be displayed to the end user. help: type: string description: >- Tooltip (or additional help text) for the field. This will be displayed to the end user. type: $ref: '#/components/schemas/FieldType' description: The type of the field. default_to_current_user: type: boolean default: false description: >- For SINGLE_USER_OPTION_PICKER and MULTI_USER_OPTION_PICKER field types only. The value defaults (auto-fills) to the end user filling the form. options: type: array items: $ref: '#/components/schemas/Option' description: For SINGLE_OPTION_PICKER and MULTI_OPTION_PICKER field types only. required: type: boolean default: false description: Conveys whether the field is mandatory during form submission. visible: type: boolean default: true description: >- Conveys whether the field is initially hidden when the form is displayed to the end user. required: - name - label - type RuleLogical: type: string enum: - value: AND - value: OR ConditionOperator: type: string enum: - value: EMPTY - value: NOT_EMPTY - value: IN - value: NOT_IN - value: EQUALS - value: NOT_EQUALS ConditionValue: oneOf: - type: boolean - type: string - type: array items: type: string Condition: type: object properties: field_name: type: string description: Name of the field whose value needs to be inspected. operator: $ref: '#/components/schemas/ConditionOperator' description: The operator to use to inspect the field_name's value. value: $ref: '#/components/schemas/ConditionValue' description: >- field_name's value will be compared against this value using the operator specified above. Note: When the operator is EMPTY, NOT_EMPTY, this attribute need not be specified. required: - field_name - operator Action: type: object properties: field_name: type: string description: Name of the target field to take action on. visible: type: boolean description: >- Marks the target field as visible or hidden when the conditions are met. required: type: boolean description: >- Marks the target field as required or optional when the conditions are met. required: - field_name - visible - required Rule: type: object properties: name: type: string description: Unique identifier for the rule within the form. logical: $ref: '#/components/schemas/RuleLogical' description: The logical operator to use to combine the conditions conditions: type: array items: $ref: '#/components/schemas/Condition' description: >- Specifies the conditions that when met, will kick off actions. If the conditions go from met to unmet, the actions will be reversed as well. actions: type: array items: $ref: '#/components/schemas/Action' description: Specifies the actions to be taken if the conditions are met. required: - name - conditions - actions Form: type: object properties: id: type: string description: Stable unique identifier for the form. image_url: type: string description: Publically accessible image URL for the form domain: $ref: '#/components/schemas/FormDomain' description: Specifies the domain the form belongs to. title: type: string description: Title of the form. This will be displayed to the end user. description: type: string description: >- A long description of the form’s purpose. This is used in our form search machine learning, and is also displayed to the end user. short_description: type: string description: >- A short description of the form’s purpose. This is used in our form search machine learning, and is also displayed to the end user. url: type: string description: >- Self-service portal URL where the user can fill out the form if in-bot form filling is not supported. last_updated_at: type: string description: >- Last updated date as a ISO-8601 UTC timestamp (e.g., 2021-10-20T17:28:52Z) fields: type: array items: $ref: '#/components/schemas/Field' description: A list of fields that make up this form. dynamic_field_rules: type: array items: $ref: '#/components/schemas/Rule' description: >- A list of rules that specify dynamic form field behavior based on user response to other fields. required: - id - domain - title - url - last_updated_at ``` ## SDK Code Examples ```python import requests url = "http://localhost:5000/myinstance1/forms/formId" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'http://localhost:5000/myinstance1/forms/formId'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "http://localhost:5000/myinstance1/forms/formId" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("http://localhost:5000/myinstance1/forms/formId") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("http://localhost:5000/myinstance1/forms/formId") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'http://localhost:5000/myinstance1/forms/formId', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("http://localhost:5000/myinstance1/forms/formId"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5000/myinstance1/forms/formId")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```