Jump to content

Recommended Posts

Posted (edited)

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
  );


Thanks!

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

Edited by Mike Mc
  • 3 weeks later...
Posted

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.

  • Recently Browsing   0 members

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