{"id":6243,"date":"2024-08-27T15:56:50","date_gmt":"2024-08-27T22:56:50","guid":{"rendered":"https:\/\/support.gwapps.com\/?post_type=ht_kb&#038;p=6243"},"modified":"2024-08-27T15:56:51","modified_gmt":"2024-08-27T22:56:51","slug":"update-record-attachments","status":"publish","type":"ht_kb","link":"https:\/\/support.gwapps.com\/es\/knowledge-base\/update-record-attachments\/","title":{"rendered":"Update Record Attachments"},"content":{"rendered":"\n<p>API endpoint to update a record by uploading files to fields of the field type &#8216;Attachment &#8216;.<\/p>\n\n\n\n<p>Note: This API documentation is intended to give the reader an overview of the APIs capabilities and how to access them. When trying to write API calls, we strongly recommend you use the API documentation directly associated with the specific API key you will be calling. That documentation includes examples with the actual IDs of the form and form elements, includes examples for each field available in the associated forms etc. This will allow direct copy-paste of the code snippets from the documentation into your code. If you were to try and use the examples in this documentation, you would have to modify them for the fields, form ID, etc.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">HTTP request<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">PUT https:\/\/api.gwapps.com\/v1\/forms\/<em>formId<\/em>\/records\/<em>recordId<\/em>\/attachments<\/pre>\n\n\n\n<p>start<\/p>\n\n\n\n<p>Note:&nbsp;This endpoint is exclusive to upload attachments to record with File Picker fields, only these fields can be updated through this endpoint.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Parameters<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Description<\/th><th>Type<\/th><\/tr><\/thead><tbody><tr><td colspan=\"3\">Required path parameters<\/td><\/tr><tr><td>formId<\/td><td>The current formId&nbsp;66b18359dc7659dc4cb98d15<\/td><td>string<\/td><\/tr><tr><td>recordId<\/td><td>The recordId<\/td><td>string<\/td><\/tr><tr><td colspan=\"3\">Optional query parameters<\/td><\/tr><tr><td>replaceAttachments<\/td><td>If query param is passed with value&nbsp;<strong>true<\/strong>&nbsp;will replace the existing attachments in the field data, otherwise will append the attachments to the current field data<\/td><td>boolean<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>start<\/p>\n\n\n\n<p>Note:&nbsp;To upload the files, the HTTP request must be a&nbsp;<strong>multipart\/form-data<\/strong>&nbsp;in order to send the files to the endpoint. Where the field names in the request are the field short codes and the value the attachments to upload<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Request Body<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Parameter<\/th><th>Description<\/th><th>Type<\/th><\/tr><\/thead><tbody><tr><td colspan=\"3\">Required parameters<\/td><\/tr><tr><td>Field Short Code*<\/td><td>Each field in the form has a unique shortCode. You can find the Field Short Codes in form &#8220;Overview&#8221; section. You can also update your field Short Codes from the Field Properties in Form Designer.<\/td><td><em>*<\/em>&nbsp;Only File Picker fields are supported. Refer to form &#8220;Overview&#8221;.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Example Request<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">PUT https:\/\/api.gwapps.com\/v1\/forms\/<em>66b18359dc7659dc4cb98d15<\/em>\/records\/<em>recordId<\/em>\/attachments<\/pre>\n\n\n\n<p>warning<\/p>\n\n\n\n<p>Make sure to review the validation applied to the File Picker field in the form design, since this endpoint validates the&nbsp;<strong>file type<\/strong>&nbsp;and&nbsp;<strong>file size<\/strong>&nbsp;allowed in the field, if the fields to upload does not match validation the endpoint will return an array of errors for each file and the error message where the validation was not met.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example Error Response<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n  \"error\": [\n    {\n      \"fieldCode\": \"attachment1\",\n      \"fileName\": \"file.zip\",\n      \"mimeType\": \"application\/zip\",\n      \"message\": \"This file type is not supported.\"\n    },\n    {\n      \"fieldCode\": \"attachment1\",\n      \"fileName\": \"file.md\",\n      \"mimeType\": \"text\/markdown\",\n      \"message\": \"This file type is not supported.\"\n    }\n  ]\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Response<\/h4>\n\n\n\n<p>The response returned will have the record information, where<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Attribute<\/th><th>Description<\/th><th>Type<\/th><\/tr><\/thead><tbody><tr><td>_id<\/td><td>The record ID<\/td><td>string<\/td><\/tr><tr><td>stage<\/td><td>The record&#8217;s stage<\/td><td>Stage<\/td><\/tr><tr><td>shortCode<\/td><td>Depends on field type<\/td><td>Each value is different depending on the field type<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Example Response<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n  \"kind\": \"form#record\",\n  \"_id\": \"recordId\",\n  \"meta\": {\n    \"appId\": \"6266db8cbd86d9001a70c9ea\",\n    \"formId\": \"66b18359dc7659dc4cb98d15\"\n  },\n  \"stage\": {\n    \"id\": \"stg0\",\n    \"status\": \"Draft\"\n  },\n  \"text1\": \"John\",\n  \"number1\": 10,\n  \"currency1\": {\n    \"code\": \"USD\",\n    \"value\": 120\n  }\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Related API Articles<\/h2>\n\n\n\n<p>This article covers details for a specific API call\/endpoint. Details of the overall Records API structure and calls\/endpoints can be found in the <a href=\"https:\/\/support.gwapps.com\/?post_type=ht_kb&amp;p=6232\">GW Apps Records API<\/a> article. Information on creating API Keys can be found within the <a href=\"https:\/\/support.gwapps.com\/knowledge-base\/platform-api-keys\/\" target=\"_blank\" rel=\"noreferrer noopener\">API section<\/a> of the <a href=\"https:\/\/support.gwapps.com\/knowledge-base\/platform-settings-overview\/\" target=\"_blank\" rel=\"noreferrer noopener\">Platform Settings<\/a>, and in the Security &gt; <a href=\"https:\/\/support.gwapps.com\/knowledge-base\/security-api-key-configuration\/\">API Keys<\/a> section of Edit App within each application.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GW Apps API endpoint to update a record by uploading files to fields of the field type &#8216;Attachment &#8216;.<\/p>","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"content-type":"","footnotes":""},"ht-kb-category":[121],"ht-kb-tag":[76,120,118,119],"class_list":["post-6243","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-api","ht_kb_tag-api","ht_kb_tag-api-call","ht_kb_tag-api-endpoint","ht_kb_tag-api-method"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Update Record Attachments - GW Apps - Support<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/support.gwapps.com\/es\/knowledge-base\/update-record-attachments\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Update Record Attachments - GW Apps - Support\" \/>\n<meta property=\"og:description\" content=\"GW Apps API endpoint to update a record by uploading files to fields of the field type &#039;Attachment &#039;.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/support.gwapps.com\/es\/knowledge-base\/update-record-attachments\/\" \/>\n<meta property=\"og:site_name\" content=\"GW Apps - Support\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/gwappsinc\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-27T22:56:51+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@GWApps_Inc\" \/>\n<meta name=\"twitter:label1\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/knowledge-base\\\/update-record-attachments\\\/\",\"url\":\"https:\\\/\\\/support.gwapps.com\\\/knowledge-base\\\/update-record-attachments\\\/\",\"name\":\"Update Record Attachments - GW Apps - Support\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#website\"},\"datePublished\":\"2024-08-27T22:56:50+00:00\",\"dateModified\":\"2024-08-27T22:56:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/knowledge-base\\\/update-record-attachments\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/support.gwapps.com\\\/knowledge-base\\\/update-record-attachments\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/knowledge-base\\\/update-record-attachments\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/support.gwapps.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Update Record Attachments\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#website\",\"url\":\"https:\\\/\\\/support.gwapps.com\\\/\",\"name\":\"GW Apps - Support\",\"description\":\"Democratizing web app development for businesses\",\"publisher\":{\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/support.gwapps.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#organization\",\"name\":\"GW Apps\",\"url\":\"https:\\\/\\\/support.gwapps.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/support.gwapps.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/GWApps_logo_black.png\",\"contentUrl\":\"https:\\\/\\\/support.gwapps.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/GWApps_logo_black.png\",\"width\":745,\"height\":357,\"caption\":\"GW Apps\"},\"image\":{\"@id\":\"https:\\\/\\\/support.gwapps.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/gwappsinc\",\"https:\\\/\\\/x.com\\\/GWApps_Inc\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/gwapps\\\/posts\\\/?feedView=all\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCyN1tnP1Owrti0PYxEkQDaQ\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Update Record Attachments - GW Apps - Support","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/support.gwapps.com\/es\/knowledge-base\/update-record-attachments\/","og_locale":"es_MX","og_type":"article","og_title":"Update Record Attachments - GW Apps - Support","og_description":"GW Apps API endpoint to update a record by uploading files to fields of the field type 'Attachment '.","og_url":"https:\/\/support.gwapps.com\/es\/knowledge-base\/update-record-attachments\/","og_site_name":"GW Apps - Support","article_publisher":"https:\/\/www.facebook.com\/gwappsinc","article_modified_time":"2024-08-27T22:56:51+00:00","twitter_card":"summary_large_image","twitter_site":"@GWApps_Inc","twitter_misc":{"Tiempo de lectura":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/support.gwapps.com\/knowledge-base\/update-record-attachments\/","url":"https:\/\/support.gwapps.com\/knowledge-base\/update-record-attachments\/","name":"Update Record Attachments - GW Apps - Support","isPartOf":{"@id":"https:\/\/support.gwapps.com\/#website"},"datePublished":"2024-08-27T22:56:50+00:00","dateModified":"2024-08-27T22:56:51+00:00","breadcrumb":{"@id":"https:\/\/support.gwapps.com\/knowledge-base\/update-record-attachments\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/support.gwapps.com\/knowledge-base\/update-record-attachments\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/support.gwapps.com\/knowledge-base\/update-record-attachments\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/support.gwapps.com\/"},{"@type":"ListItem","position":2,"name":"Update Record Attachments"}]},{"@type":"WebSite","@id":"https:\/\/support.gwapps.com\/#website","url":"https:\/\/support.gwapps.com\/","name":"GW Apps - Soporte","description":"Democratizando el desarrollo de aplicaciones web para empresas","publisher":{"@id":"https:\/\/support.gwapps.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/support.gwapps.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/support.gwapps.com\/#organization","name":"GW Apps","url":"https:\/\/support.gwapps.com\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/support.gwapps.com\/#\/schema\/logo\/image\/","url":"https:\/\/support.gwapps.com\/wp-content\/uploads\/2021\/04\/GWApps_logo_black.png","contentUrl":"https:\/\/support.gwapps.com\/wp-content\/uploads\/2021\/04\/GWApps_logo_black.png","width":745,"height":357,"caption":"GW Apps"},"image":{"@id":"https:\/\/support.gwapps.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/gwappsinc","https:\/\/x.com\/GWApps_Inc","https:\/\/www.linkedin.com\/company\/gwapps\/posts\/?feedView=all","https:\/\/www.youtube.com\/channel\/UCyN1tnP1Owrti0PYxEkQDaQ"]}]}},"_links":{"self":[{"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb\/6243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/comments?post=6243"}],"version-history":[{"count":5,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb\/6243\/revisions"}],"predecessor-version":[{"id":6294,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb\/6243\/revisions\/6294"}],"wp:attachment":[{"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/media?parent=6243"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb-category?post=6243"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/support.gwapps.com\/es\/wp-json\/wp\/v2\/ht-kb-tag?post=6243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}