[SalesForce] How to create new KnowledgeArticle record from API

I am looking into building a web app using either the SOAP or REST API that would allow our clients team to generate new knowledgebase articles (service cloud) to be submitted to salesforce via the API.

This is for an internal portal project to make it easier for our client's team to format the articles.

I have found good information on creating new versions of an existing KnowledgeArticleVersion. However it is not clear from the documentation I have found how you would create a completely new KnowledgeArticle from scratch.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_knowledgearticleversion.htm This page of the API docs talks about creating a new knowledge article, but I believe they are saying a new version of an existing article.

Is anyone able to provide any insight on how/if this can be accomplished through the API?

Best Answer

The knowledge article data model is polymorphic in nature.

Hence the creation of the knowledge article process is similar to creation of any other record except we have articletype appended by __kav to get the object name.

Hence to create initial version via API i would use the same calls as I use for other objects.

You will have to insert a knowledge article using the API as below:

curl https://na1.salesforce.com/services/data/v20.0/sobjects/FAQ__kav/ \ 
  -H "Authorization: Bearer token \
  -H "Content-Type: application/json" \
  -d @newaccount.json"

# newaccount.json:
{
   "summary" : "Express Logistics and Transport"
  //Include various fields here 
}

Remember to set up REST API you will first have to OAUTH with salesforce or obtain session ID using login() call

Also once you draft an article you can manage its lifecycle through various API documented in chapter four of the guide.

Related Topic