Jump to content

Downloads Rest API, How To POST To Custom Fields?

Recommended Posts

I have 2 custom fields created for my downloads files, i see that the database is saving the records in the 'downloads_ccontent' table. Using the API is there way to post new values for these fields when creating a new download through the REST API?

I have tried a few variations of passing extra fields in the post data, and they do not seem to work.

IE: the "Fields" array below

$curl_post_data = array(
		'category' => 2,
        'author' => 1,    
		'title' => 'Test File Upload',
        'description' => $file_desc,
  		'files' => array(
          	$filename => urlencode(file_get_contents($file_url)), 
            $filename2 => urlencode(file_get_contents($file_url2))
        'version' => '2021.02.06',
        'screenshots' => array( 
            'testname.jpg' => urlencode(file_get_contents('/local/directory/')),
            'testname2.jpg' => urlencode(file_get_contents('/local/directory/'))
        'fields' => array (
            'field_1' => 'HERE IS THE DATA FOR FIELD 1',
            'field_2' => 'HERE IS THE DATA FOR FIELD 2'
        'prefix' => NULL,
        'tags' => 'tag1, tag2, tag3',
        'date' => NULL,
        'ip_address' => NULL,
        'locked' => 0,
        'hidden' => 1,
        'pinned' => 0,
        'featured' => 0


@Adriano Faria or @IPCommerceFan or @bfarber you all seem to have good API knowledge so i tagged you 😃 

Edited by Mike Mc
Link to comment
Share on other sites

  • 3 weeks later...

I have a working solution, but I am just interfacing directly with the DB to save the information. It's hack but works for my purpose. I would have greatly appreciated using the API to update the custom fields but it appears the API is not capable.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...