calling and kentico restfull service from winform

benyamin jain asked on September 2, 2016 16:35

Hi is it possible to consume kentico restfull service from winforms application?

for example i want to have a windows form application with following capabilities:

1 - user enter his user name and password that defined for him in kentico website

2 - if user login was successful then we allow him to fetch data , insert and edit and delete custom tabel data

I want to do all steps using kentico cms rest API.

any suggestion and help.

with best regards

Correct Answer

Roman Hutnyk answered on September 2, 2016 16:40

Benyamin, yes it is possible. You'll need to configure Kentico RESt service to use basic authentication. Winforms app will have to encode username/pass into base64 string and add it into request as authorization header - that's it! If credentials are correct and user is authorized to modify custom table items within Kentico the request will be executed successfully.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Virgil Carroll answered on September 2, 2016 16:41 (last edited on September 2, 2016 16:42)

Simple answer is Yes. You can use Basic Authentication for this and pass the User ID and Password to restful call. You will also need to create an authentication token as described in the article below

Authentication Types https://docs.kentico.com/display/K9/Authenticating+REST+requests

CRUD Methods https://docs.kentico.com/display/K9/Manipulating+data+using+REST

0 votesVote for this answer Mark as a Correct answer

benyamin jain answered on September 2, 2016 17:35

Virgil and Roman thank you for your fast reply.

Currently i am working on this sample.if it is completed i will post it here.

But it is possible to face with other problems , in that case i will post my question here then in such case i need your guides hope you help me :).

Yours sincerely

benyamin

0 votesVote for this answer Mark as a Correct answer

benyamin jain answered on September 3, 2016 11:58 (last edited on September 3, 2016 11:59)

Hi again

i am configure all required settings based on guide in kentico help.

also i define a user with permission to read/modify/create for custom tables

but when i sent a GET request to the site i face with HTTP/1.1 403 Forbidden response.

HTTP/1.1 403 Forbidden
Cache-Control: private
Server: Microsoft-IIS/7.5
Set-Cookie: CMSPreferredCulture=en-US; expires=Sun, 03-Sep-2017 09:47:24 GMT; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=0eiqcldsmkglgokcdcnbrkbn; path=/; HttpOnly
X-AspNet-Version: 4.0.30319
X-Frame-Options: SAMEORIGIN
X-Powered-By: ASP.NET
Date: Sat, 03 Sep 2016 09:47:24 GMT
Content-Length: 0

Request :

GET http://www.samid.com/rest/cms.user/all HTTP/1.1
User-Agent: Fiddler
Accept-Encoding: utf-8
Host: www.samid.com
Authorization: Basic saat : 123456

what is wrong?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.