Learn how to upload files to Master Data v1.
In this guide, you will learn how to upload files to Master Data v1 by following these steps:
- Step 1 - Creating a new data entity: Start by creating a new data entity to hold the data you want to upload.
- Step 2 - Publishing and indexing the data entity: After creating the entity, publish and index it to make it available via the Master Data CRM.
- Step 3 - Creating a Master Data form: Next, create a form that will allow you to upload your files.
- Step 4 - Uploading the file: Use the form to upload your files to Master Data v1.
- Step 5 - Accessing the file: Finally, see how to access the files' public URLs.
Step by step
Step 1 - Creating a new data entity
In this step, you will create a new data entity to represent a collection of files. This entity will include a file-type field dedicated to storing files.
- Access the DynamicStorage at
https://{accountName}.ds.vtexcrm.com.br
.Remember to replace the value between curly braces with your account name.
- Click Data Entities in the top bar.
- Click Add New.
- In the Acronym field, enter a two-letter acronym for the data entity you are creating.
- In Name, enter the name of the data entity that will store the PDF file (e.g., Files, PDFs).
- Go to the Fields tab. In the Name field, enter a new name for the field that will store the file in lowercase letters (e.g., filename).
- In Display Name, enter the data entity name chosen in Step 5, but with uppercase in the first letter (e.g., Files, Pdf).
- In the Type dropdown menu, select File.
- Click the "engine" icon on the right side of the Type field.
- Under the General settings section, select the Make readable without credential checkbox to make the data saved via this field available without the need for authentication.
- On Custom field type settings, select the Max size per file according to your needs. This sets the maximum file size that can be uploaded to this field.
- Click Save.
Step 2 - Publishing and indexing the data entity
As the next step, you will now publish and index your newly created data entity.
- On the Data Entities tab, find the data entity you created in the previous step and click the "blue disk" icon on the left side of the line to publish the entity.
- Click Ok to continue.
- Click the "four arrows" icon to reindex the data entity.
Wait for the data entity to be fully indexed. This may take from 30 minutes to one hour. During this time, do not make any changes to the data entity or its fields. Note that there is currently no interface to monitor the progress of indexation. Instead, you can periodically check the status of the entity.
Step 3 - Creating a Master Data form
Once your data entity is successfully indexed, you can proceed to create a form. This form will define how your data entity will be displayed and handled.
- After indexation is completed, access the Master Data CRM at
https://{account}.vtexcrm.com.br
.Remember to replace the value between curly braces with your account name.
- Click the Advanced settings tab.
- Click Formulários.
- Click Novo to create a new form.
- In the Nome field, enter the name of the formulário, which should be the same as the data entity name.
- In Entidade de Dados, select the data entity you previously created.
- In the Campos de Listagem tab, select the Id do Registro and the data entity you previously created.
- Change to the Schemas de Layout tab.
- Click the Incluir nova seção button to add a new section to the form.
- In the Nome field, enter a name for the section.
- Select the data entity previously created from the column Campos disponíveis. Then, drag and drop it into the column Campos da coluna 1.
- Click Save.
Step 4 - Uploading the file
Now, access the Master Data CRM at https://{account}.vtexcrm.com.br
to upload your files.
Remember to replace the value between curly braces with your account name.
By now, when accessing the Master Data CRM, you should see a new tab with the name of the form you just created. If that's not the case, reload the page.
- Click the tab with the name of your new form.
- Click Novo.
- Click the Upload a File button. Choose your file and click Open.
- After the upload, click Save.
Step 5 - Accessing the file
Finally, after uploading your files, you can access and share their URLs by following these steps:
- In the Master Data CRM, click the tab with the name of your new form.
- Copy the Id do Registro value and save it. The Id do Registro value has the following pattern:
{acronym}-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
. - Assemble the file's public URL and use it to access the file. Use this pattern to assemble the URL:
https://{account}.vtexcommercestable.com.br/api/dataentities/{acronym}/documents/{idWithouthAcronym}/{fieldName}/attachments/{file}
, where:acronym
- Two-letter acronym that identifies the data structureidWithouthAcronym
- Id of the document, without the acronym, i.e., theXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
part from the Id do Registro value.fieldName
- Name of the field created in step 6 of Step 1 - Creating a new data entity.file
- Name of the file followed by its extension (e.g.,myfile.pdf
).