hi all, akeneo again…
i try to update a product image, hers is the doc
REQUEST
POST /api/rest/v1/media-files
Path parameters
Query parameters
Headers
Authorization
• Equal to ‘Bearer xxx’, xxx
being the authentication token, see Authentication section
Content-type
• Equal to ‘multipart/form-data’, no other value allowed
Body
Given as form-data
product
(string ) • The product to which the media file will be associated. It is a JSON string that follows this format ‘{“identifier”:“product_identifier”, “attribute”:“attribute_code”, “scope”:“channel_code”,“locale”:“locale_code”}’.
file
(string / binary) • The binaries of the file
ok, i did it in postman, it works
Then i try with n8n
i got a file by requesting an url
set a http request like postman an use $node[“HTTP Request”].binary.data for file value
But i got this error :
ERROR: source.on is not a function
thanks for help
{
"nodes": [
{
"parameters": {
"requestMethod": "POST",
"url": "https://pim-poc.coreplighting.net/api/rest/v1/media-files",
"options": {
"bodyContentType": "multipart-form-data"
},
"bodyParametersUi": {
"parameter": [
{
"name": "product",
"value": "{\"identifier\":\"10627329\", \"attribute\":\"picture\", \"scope\":null,\"locale\":null}"
},
{
"name": "file",
"value": "={{$node[\"HTTP Request\"].binary.data}}"
}
]
},
"headerParametersUi": {
"parameter": [
{
"name": "Authorization",
"value": "=Bearer {{$node[\"Pim Produit Tokens\"].json[\"tokenwrite\"]}}"
},
{
"name": "Content-Type",
"value": "multipart/form-data"
}
]
}
},
"name": "PIMPOC write Product media file1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
400,
240
]
},
{
"parameters": {
"url": "https://somewhere.jpg",
"responseFormat": "file",
"options": {}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
180,
240
]
}
],
"connections": {
"HTTP Request": {
"main": [
[
{
"node": "PIMPOC write Product media file1",
"type": "main",
"index": 0
}
]
]
}
}
}