Sitefinity WebService -Odata

267 Views Asked by At

I am using Sitefinity webservice module to post data to the content. I am using Postman to test the POST method for odata.

My Post method       /api/AzureFunctionSitefinity/azuresitefinityintegrations

My Model :APPLICATION/JSON

  {
    "UrlName": "sample string 1",
    "Title": "sample string 2",
    "VacancyId": 1.0,
    "VacancyReferenceNumber": 1.0,
    "VacancyGuid": "sample string 3",
    "ShortDescription": "sample string 4",
    "StartDate": "2017-09-19T07:32:50.5023011Z",
    "EndDate": "2017-09-19T07:32:50.5023011Z"
    }

Whenever I am posting using the content-type application/json for odata its returning 200 rather than 201 which i am expecting it to return.

Even i tried posting with

 {
"@odata.type" :"Telerik.Sitefinity.DynamicTypes.Model.AzureFunctionSitefinityIntegration.AzureSitefinityIntegration",
"PublicationDate": "2017-09-19T08:03:53.5165122Z",
 "ExpirationDate": "2017-09-19T08:03:53.5165122Z",
 "UrlName": "sample string 
 "Title": "sample string 3",
 "VacancyId": 1.0,
 "VacancyReferenceNumber": 1.0,
 "VacancyGuid": "sample string 4",
 "ShortDescription": "sample string 5",
 "StartDate": "2017-09-19T08:03:53.5165122Z",
 "EndDate": "2017-09-19T08:03:53.5165122Z"
 }

Still i am getting 200 . I am expecting it to return 201 which says that the data has been created.

Any help on this will be highly appreciated. I am using Postman to post the odata

1

There are 1 best solutions below

2
On

I have tested the mentioned sample with Sitefinity 10.1 and status 401 unauthorized is returned when I don't pass the bearer token. Here is a video Which Siteifnity version are you using. I would recommend to use the JavaScript SDK for you client calls. The library will handle everything internally.