cancel
Showing results for 
Search instead for 
Did you mean: 

Issue when attempting to POST contentItem type "Page"

Former Member
0 Kudos

Hi,

I'm trying to create a wiki page in JAM using OData.  I first manually created a wiki page in Jam and I'm able to extract it using GET.  My returned wiki page is ContentItems & ContentItemType=Page.

I'm now trying to create a wiki page via POST using the following uri:

...api/v1/OData/ContentItems

When I process the request, I get an error stating that I'm missing the Slug entry in the header.  When I add this entry to the header, it creates a type document in JAM instead of a wiki page.

Here is the xml returned from Jam when I query my existing wiki page:

<category term="SAPJam.ContentItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category>

   <content type="text/html;type=wiki" src="https://jam12.sapjam.com/api/v1/OData/ContentItems(Id='BRwGUmwI0tNx7FEajH5lw9',ContentItemType='Page..."></content>

   <m:properties>

      <d:Id m:type="Edm.String">BRwGUmwI0tNx7FEajH5lw9</d:Id>

      <d:Name m:type="Edm.String">Test Wiki</d:Name>

      <d:ContentItemType m:type="Edm.String">Page</d:ContentItemType>

      <d:Description m:type="Edm.String" m:null="true"></d:Description>

      <d:CreatedAt m:type="Edm.DateTimeOffset">2015-12-10T16:32:25Z</d:CreatedAt>

      <d:LastModifiedAt m:type="Edm.DateTimeOffset">2015-12-10T16:32:25Z</d:LastModifiedAt>

      <d:ViewsCount m:type="Edm.Int32">2</d:ViewsCount>

      <d:Liked m:type="Edm.Boolean">false</d:Liked>

      <d:LikesCount m:type="Edm.Int32">0</d:LikesCount>

      <d:IsFeatured m:type="Edm.Boolean">false</d:IsFeatured>

      <d:PermissionType m:type="Edm.String">full</d:PermissionType>

      <d:DocumentSize m:type="Edm.Int32" m:null="true"></d:DocumentSize>

      <d:FileName m:type="Edm.String" m:null="true"></d:FileName>

      <d:ConversionStatus m:type="Edm.String">not_applicable</d:ConversionStatus>

      <d:IsCheckedOut m:type="Edm.Boolean">false</d:IsCheckedOut>

   </m:properties>

</entry>

I use the same templated xml when using my post, but I do not send an ID and I change the name to "Test Wiki 2".  Here is the response from JAM when I add the Slug Header as :Slug:test.  Notice the ContentItemType changed from Page to Document.

<category term="SAPJam.ContentItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"></category>

   <content type="text/html;type=wiki" src="https://jam12.sapjam.com/api/v1/OData/ContentItems(Id='nvTJBpE6D2cTyVoebg6oUa',ContentItemType='Docu..."></content>

   <m:properties>

      <d:Id m:type="Edm.String">nvTJBpE6D2cTyVoebg6oUa</d:Id>

      <d:Name m:type="Edm.String">test</d:Name>

      <d:ContentItemType m:type="Edm.String">Document</d:ContentItemType>

      <d:Description m:type="Edm.String" m:null="true"></d:Description>

      <d:CreatedAt m:type="Edm.DateTimeOffset">2015-12-15T16:43:39Z</d:CreatedAt>

      <d:LastModifiedAt m:type="Edm.DateTimeOffset">2015-12-15T16:43:39Z</d:LastModifiedAt>

      <d:ViewsCount m:type="Edm.Int32">0</d:ViewsCount>

      <d:Liked m:type="Edm.Boolean">false</d:Liked>

      <d:LikesCount m:type="Edm.Int32">0</d:LikesCount>

      <d:IsFeatured m:type="Edm.Boolean">false</d:IsFeatured>

      <d:PermissionType m:type="Edm.String">full</d:PermissionType>

      <d:DocumentSize m:type="Edm.Int32">1213</d:DocumentSize>

      <d:FileName m:type="Edm.String">test</d:FileName>

      <d:ConversionStatus m:type="Edm.String">not_applicable</d:ConversionStatus>

      <d:IsCheckedOut m:type="Edm.Boolean">false</d:IsCheckedOut>

   </m:properties>

</entry>

Here is the response when I remove the "Slug" from the header:

<?xml version="1.0" encoding="UTF-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code></code><message xml:lang="en">Filename not specified. Slug header or Content-Disposition header may be missing or malformed.</message></error>

Thanks,


Warren

Accepted Solutions (1)

Accepted Solutions (1)

Adam_Stone
Active Contributor
0 Kudos

It looks like you are missing setting the Content-Type Header as part of your post.  It needs to have the value of:
text/html;type=wiki

If you don't have this, it will change to document.

Former Member
0 Kudos

Thanks Adam,

This was part of the issue.  As you stated, the mime type had to be set to text/html;type=wiki.  Also, the slug had to be set (as this is the name of the wiki to be created)..and lastly, the xml I was using was not relevant, it was the raw html content of the wiki that I had to pass, not the xml.

Thanks,

Warren

Answers (0)