Uploading Documents to Sugar via Web Services

sugarcrmdevelopers —  August 16, 2012 — 5 Comments

I’ve came across many questions around using the Web Services API in Sugar to upload files into Sugar. As you know, Sugar supports storing files attached to the records of Notes, as well as having a Documents module to track uploaded files and manage the revisions made to them. Our web services API supports uploading to them, but it isn’t exactly clear on how to do this. For today, let’s look at how to do this for Documents

Let’s first look at create a new Document record, and then uploading a new Document to it. First the easy part, let’s build the document record.

Now with a Document record, we can call the set_document_revision method to actually upload the document. You’ll be pushing the raw document contents up here, and you’ll need to be sure it’s base64 encoded.

The nice part about the Documents module is that it stores each revision made to a document as a part of the record. This means that for each new call made to set_document_revision, it automatically creates a new revision for you and saves the old one.

Come back tomorrow and we’ll see how to upload Note attachments to Sugar.

5 responses to Uploading Documents to Sugar via Web Services

  1. 

    Cool… Good stuff

  2. 

    Nice

    But I have a problems when file is up 5,5kb (without base64). The file did not upload.

    Is there any configuration to do?

Trackbacks and Pingbacks:

  1. SugarCRM Developer Blog » Blog Archive » Uploading Note attachments to Sugar via Web Services - August 17, 2012

    […] SugarCRM Developer Blog « Uploading Documents to Sugar via Web Services […]

  2. SugarCRM Developer Blog » Blog Archive » Downloading a Document Revision via Web Services - August 20, 2012

    […] talked last week about how to create a new Document record and upload versions of the document to Sugar via […]

  3. Create record in Documents module via code - August 25, 2012

    […] code I've never done it with the documents module before personally but the process is shown here. You would do it though the SOAP/REST […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s