Return to Jive Software

Skip navigation
7,855 Views 7 Replies Last post: Sep 8, 2008 8:15 AM by todd.west RSS
santhosh_ Novice 14 posts since
Jul 3, 2008
Currently Being Moderated

Aug 25, 2008 10:21 PM

Adding Image to a Blog post using webservice

I am migrating a set og wordpress blogs to clearspace community 2.4.0. While recreating those blogs in clearspace(Using webservice APIs) I want to add the images in the blogpost body also. After adding that image to the blogpost, I want to update the src attribute of the img html tag too.

But how will I get the link of an image  after adding it to blogpost?

void addImageToBlogPost(long blogPostID,
                        java.lang.String name,
                        java.lang.String contentType,
                        byte[] source)

 

This method returns void. Could you please also explain the APi usage for creating a blogpost with image inside?

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
Aug 26, 2008 3:03 PM in response to: santhosh
Re: Adding Image to a Blog post using webservice

Hi,

 

The addImageToBlogPost webservices call will take a image file stream that you give it and automatically upload it to your Clearspace instance and associate it with the specified blog post. When you are viewing this blog post you will be able to access this image by clicking on the Image button in the Rich Text Editor. Your new image will show up in the list of Uploaded images.

 

 

If you want to retrieve the name of this image via webservices you will want to use the getImagesByBlogPostID method:

 

http://www.jivesoftware.com/builds/docs/clearspace/latest/RestServicesReference.html#BlogService_getImagesByBlogPostID_long

 

 

This will an array of images associated with this blog post. Once you have the filename of the image that you want you can add it to your post by using this syntax:

 

!myFileName.jpg|alt=MyFileName.jpg!

 

 

Thanks.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
Aug 27, 2008 8:26 AM in response to: santhosh
Re: Adding Image to a Blog post using webservice

Hi Santhosh,

 

Since you are using the {code:html} macro you will not be able to use the src attribute of the img tag. All "src" tags are stripped out of posts automatically to avoid any possible XSS (Cross Site Scripting) attacks. The only way for you to use images in your post via web services is to close your {code} macro when you are going to insert an image, use the !myFileName.jpg|alt=MyFileName.jpg! markup and then start a new {code:html} macro again.

 

Of course, this is all assuming that you are running Clearspace 2.0.x and not Clearspace 2.5. If you have any further questions please let me know. Thanks.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
Aug 29, 2008 9:36 AM in response to: santhosh
Re: Adding Image to a Blog post using webservice

Hi Santhosh,

 

Unfortunately, after some extensive testing it appears that this kind of functionality is not possible. Even when done from the front-end it doesn't seem to be possible to have the HTML macro mixed with the wiki syntax at all. I believe that this is somewhat different in 2.5 because wiki markup has basically been eliminated and we've moved to an HTML only implementation. You might be able to achieve this functionality in 2.5 but I am not sure about 2.0.x.

 

If you have any further questions please let me know. Thanks.

 

-Todd

todd.west Jive Employee 15,926 posts since
Jul 14, 2008
Currently Being Moderated
Sep 8, 2008 8:15 AM in response to: santhosh
Re: Adding Image to a Blog post using webservice

Hi,

 

I don't think that you can retrieve the wiki formatted content of a blog but you should be able to send in wiki text directly. If you can convert your HTML to wiki text automatically you should be able to embed images just fine using the wiki syntax. Thanks.

 

-Todd

More Like This

  • Retrieving data ...

Bookmarked By (0)

To better serve our customers we have included functionality to automatically follow up on a case after it has been idle for more than 5 days, and then auto close after an additional 3 days of inactivity. Choose No to acknowledge that this case will remain idle for longer than 5 days.
Making cases public allows other customers to learn from the solution of the case. It can also be used to gain feedback from others in the community. Ask our Support Engineers for more info, but we encourage you to make your cases public.