Boa tarde,
Estou tentando adicionar um attachment a um item utilizando a api de orderForm como exemplificado abaixo:
URL: /api/checkout/pub/orderForm/${response.orderFormId}/items/${itemCustom}/attachments/GiftLabelNew
Porém ele sempre me retorna que a chave que estou tentando inserir é inválida, com a mensagem
“A chave giftlabelnew do anexo é inválida”
No payload tenho a seguinte estrurura:
{content: {,…},…} content : {,…} giftlabelnew : "{\"produtoOrigem\":\"35646\",\"fundo\":\"\",\"fonte\":\"Johnnie Walker\",\"linha01\":\"Você é \",\"linha02\":\"Um Super Pai\",\"fraseCustom\":\"sim\"}" expectedOrderFormSections : ["items", "totalizers", "clientProfileData", "shippingData", "paymentData", "sellers", "messages",…] 0 : "items" 1 : "totalizers" 2 : "clientProfileData" 3 : "shippingData" 4 : "paymentData" 5 : "sellers" 6 : "messages" 7 : "marketingData" 8 : "clientPreferencesData" 9 : "storePreferencesData" 10 : "giftRegistryData" 11 : "ratesAndBenefitsData" 12 : "openTextField" 13 : "commercialConditionData" 14 : "customData" noSplitItem : true
e no meu código faço a implementação da seguinte forma em react:
fetch(
`/api/checkout/pub/orderForm/${response.orderFormId}/items/${itemCustom}/attachments/GiftLabelNew`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
content: { "GiftLabelNew":""+JSON.stringify(attachmentContent)+"" },
expectedOrderFormSections: [
'items',
'totalizers',
'clientProfileData',
'shippingData',
'paymentData',
'sellers',
'messages',
'marketingData',
'clientPreferencesData',
'storePreferencesData',
'giftRegistryData',
'ratesAndBenefitsData',
'openTextField',
'commercialConditionData',
'customData',
],
noSplitItem: true,
}),
}
)
.then((response) => response.json())
.then((data) =>{ console.log("Resposta Pós Attachment",data)})
.catch(err => console.error(err));
Qual a estrutura correta de json para adição de informações no campo attachment contido no item? Poderiam me ajudar?
Desde já agradeço