Inhalte aufrufen

Profilbild

Simple demo Web API for newbie


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
8 Antworten zu diesem Thema

#1 ltbaogt

ltbaogt

    Newbie

  • Members
  • 3 Beiträge

Geschrieben: 16 April 2014 - 15:47

- Hello everyone, sorry my bad English.

 

- I'm a newbie Smartstore and I'd like everyone can guide me a tutorial to call Web API in Visual Studio 2012 with Smartstore version 2.xx.

 

- I have downloaded web API client tool but how to get public key and private key from Smartstore ?.

 

Thanks for regards.



#2 Murat Cakir

Murat Cakir

    SmartStore AG

  • Administrators
  • 1102 Beiträge

Geschrieben: 16 April 2014 - 16:07

You can create public and private keys in the backend of SmartStore.NET. Please read https://smartstore.c...le=Introduction for further info on this topic.


Murat Cakir
SmartStore AG


#3 ltbaogt

ltbaogt

    Newbie

  • Members
  • 3 Beiträge

Geschrieben: 17 April 2014 - 13:30

Thanks you !!!



#4 Jefferson

Jefferson

    Advanced Member

  • Members
  • 30 Beiträge

Geschrieben: 04 July 2014 - 18:54

Hello how could we post a entity like Order using the webapi OData?

 

For example, in the description in codeplex there's a few example about post.

 

POST http://localhost:1260/odata/v1/Orders(145)/PaymentPaid
{"PaymentMethodName":"Payments.Sofortueberweisung"}

 
 
But in this scenario there's already a key, now how could we post a Order without having the Id?
protected override void Insert(Order entity)
{
Service.InsertOrder(entity);
}
 
Should we create a object with json and fill it but how the query of OData should look's like?
 
Thanks


#5 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3407 Beiträge

Geschrieben: 04 July 2014 - 21:16

Yes, you can do that. Use POST http://localhost:1260/odata/v1/Orders without the key. The key is automatically created by the database and returned in the
response. "Making a POST request" shows for example how to add a note to an existing order.

  • Jefferson gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#6 Jefferson

Jefferson

    Advanced Member

  • Members
  • 30 Beiträge

Geschrieben: 24 July 2014 - 18:09

Hello there's any example about the laguages?

I mean, imagine that we are working with two cultures( English and Portuguese)

 

How can we obtain the product description in Portuguese with Smart Store WebAPI?

 

Thanks for the support.



#7 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3407 Beiträge

Geschrieben: 24 July 2014 - 20:35

That's not supported yet. I've created an issue for it.


  • Jefferson gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#8 Jefferson

Jefferson

    Advanced Member

  • Members
  • 30 Beiträge

Geschrieben: 06 August 2014 - 20:27

Hello Marcus,

 

I've implemented the changes that you provided and it's working.

 

Now i can take the values of the table LocalizedProperty.

 

// To list all products(without the Key criteria)

/LocalizedPropertys?$top=40&$filter=LocaleKeyGroup eq 'Product'  and Language/LanguageCulture eq 'en-US' 

 

 

 

But could you clear me a doubt?

 

I want to load all categories so i'm using this query

 

"/Categories?$top=20&$inlinecount=allpages&$select=Id,Name"

 

And it's returning all categories(the default is portuguese)

But i need to provide in english too, what's the approach to load all categories(including the english, if available of course).

 

For example, i need info that is only available in the OData of categories and i need the mult-culture variation field in this Result.

 

Should i create a kind of DTO to pass those values?

thanks



#9 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3407 Beiträge

Geschrieben: 06 August 2014 - 21:11

You have to get localized property values in a separate request
GET /LocalizedPropertys?$top=40&$filter=LocaleKeyGroup eq 'Category' and Language/LanguageCulture eq 'en-US'

  • Jefferson gefällt das

Schöne Grüße aus Düsseldorf,
Marcus Gesing