I need help adding a file to a node. I am using the media and media:youtube modules for creating links to youtube videos. My field is called field_practice. I am using the Rest Console to test adding a file. Ultimately I want to add the file when the node is created. Currently I am trying to use the PUT method to update an existing node. This current scenario is not working with an existing node:417.
Request URI:
http://nextgametime.com/app/node/attach_file/417
Content Type:
application/json
Raw Body:
{"field_practice":{"und":[{"fid":"data4.fid","filename":"Trae Jefferson", "uri":"https://youtu.be/w4vYTBzWXkg", “filemime”:”video/youtube”,"type":"video","display":"1"}]}}
Please help so that I can add a file to a node on creation and the ability to add a file when updating a node. Thanks.
Comments
Comment #2
promardi commentedComment #3
tyler.frankenstein commentedYou have to send an integer value for the fid. Here's a complete example: http://tylerfrankenstein.com/code/drupal-services-file-create-example-js...
Comment #4
promardi commentedThank you Tyler. Your support is appreciated. I will review your answer and keep you posted on the outcome.