# Submit a Form POST http://localhost:5000/myinstance1/forms/{formId}/submit Content-Type: application/json This API is primarily used for transactional activity. Performance will be essential. The following example assumes submission of the example form defined here. Anticipated load – Moveworks will call this endpoint every time a user submits a form through our native skill. Reference: https://docs.moveworks.com/api-reference/forms-gateway/smart-forms/submit-form ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Submit a Form version: endpoint_smartForms.submitForm paths: /forms/{formId}/submit: post: operationId: submit-form summary: Submit a Form description: >- This API is primarily used for transactional activity. Performance will be essential. The following example assumes submission of the example form defined here. Anticipated load – Moveworks will call this endpoint every time a user submits a form through our native skill. tags: - - subpackage_smartForms parameters: - name: formId in: path description: ID of form to submit 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: Successful form submission content: application/json: schema: $ref: '#/components/schemas/SubmitFormResponse' requestBody: content: application/json: schema: type: object properties: submitted_by: type: string description: >- System ID (usually the email address) of the user who submitted this form. fields: $ref: >- #/components/schemas/FormsFormIdSubmitPostRequestBodyContentApplicationJsonSchemaFields description: >- This is a dictionary where they keys are the "field names" coming from the schema, and the value types are string, list of strings, and boolean. See the example. form_metadata: $ref: >- #/components/schemas/FormsFormIdSubmitPostRequestBodyContentApplicationJsonSchemaFormMetadata required: - submitted_by components: schemas: FormsFormIdSubmitPostRequestBodyContentApplicationJsonSchemaFields: type: object properties: {} FormsFormIdSubmitPostRequestBodyContentApplicationJsonSchemaFormMetadata: type: object properties: name: type: string description: The name of the form being submitted last_updated_at: type: string description: >- Last updated date as a ISO-8601 UTC timestamp (e.g., 2021-10-20T17:28:52Z). Indicates the freshness of the form. required: - name - last_updated_at SubmitFormResponse: type: object properties: ticket_id: type: string description: >- The display ticket ID of the ticket that was created (if any). null value is allowed. If a valid ticket ID is returned, Moveworks will be able to fetch/poll this ticket to provide updates to the user and to accelerate resolution of their request. ``` ## SDK Code Examples ```python import requests url = "http://localhost:5000/myinstance1/forms/formId/submit" payload = { "submitted_by": "one@example.com" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'http://localhost:5000/myinstance1/forms/formId/submit'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"submitted_by":"one@example.com"}' }; 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" "strings" "net/http" "io" ) func main() { url := "http://localhost:5000/myinstance1/forms/formId/submit" payload := strings.NewReader("{\n \"submitted_by\": \"one@example.com\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") 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/submit") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"submitted_by\": \"one@example.com\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("http://localhost:5000/myinstance1/forms/formId/submit") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"submitted_by\": \"one@example.com\"\n}") .asString(); ``` ```php request('POST', 'http://localhost:5000/myinstance1/forms/formId/submit', [ 'body' => '{ "submitted_by": "one@example.com" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("http://localhost:5000/myinstance1/forms/formId/submit"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"submitted_by\": \"one@example.com\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["submitted_by": "one@example.com"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:5000/myinstance1/forms/formId/submit")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```