API Artikel Import
Last updated
by
Jürgen Weisental
**API Key erstellen**
Stammdaten -> Sonstiges -> API
Api Key Typ Artikel erstellen.
**Datenstruktur**
```
public class OnlineArticles
{
public List<OnlineArticleGroup> Groups;
public List<OnlineArticle> Articles;
}
public class OnlineArticle
{
public string Id { get; set; }
public string Name { get; set; }
public string PLU { get; set; }
public string ArticleGroupId { get; set; }
public double Price { get; set; }
public string Background { get; set; }
public string Foreground { get; set; }
public string Barcode { get; set; }
public List<OnlineArticleExtra> ArticleOptions { get; set; }
public List<PriceRule> Rules {get; set;}
public int TaxClass { get; set; }
public bool IsDeleted { get; set; }
}
TaxClass: 0=Normal, 1=Reduziert, 99=Keine
public class OnlineArticleGroup
{
public string Id { get; set; }
public string Name { get; set; }
public string ParentId { get; set; }
public List<PriceRule> Rules {get; set;}
}
public class PriceRule
{
public string Id { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public List<string> Groups { get; set; }
public List<string> Workplaces { get; set; }
public bool IsActive { get; set; }
public string Name { get; set; }
public List<PriceTimeRule> TimeRules { get; set; }
public List<int> Days { get; set; } // System.DayOfWeek
public double? PricePlusMinus { get; set; }
public double? PriceFix { get; set; }
public double? PricePercent { get; set; }
public string Source { get; set;
}
public class PriceTimeRule
{
public string Start { get; set; }
public string End { get; set; }
public double? PricePlusMinus { get; set; }
public double? PriceFix { get; set; }
public double? PricePercent { get; set; }
}
```
**Beispiel**
curl -v -d "{'Groups': \[{'Id': 'grp10','Name': 'Top Gruppe ','ParentId': ''}\], 'Articles': \[{'Id': 'art','Name': 'Test Artikel ','PLU': '100','ArticleGroupId': 'grp10','Price': 8.0,'Background': '#ffffff','Foreground': '#000000','ArticleOptions': \[\]}, {'Id': 'voM5y634kq8aHIIRicABA','Name': 'Test Artikel 22','PLU': null,'ArticleGroupId': 'grp10','Price': 0.0,'Background': '#000000','Foreground': '#ffffff','ArticleOptions': \[\]}\]}" -H "Content-Type: application/json" -X POST [https://demo.portal.dikas.de/rest/erp/import/50jtZXrOhayAk68WAQnO](https://demo.portal.dikas.de/rest/erp/import/50jtZXrOhayAk68WAQnO)
API Key Fehler wird mit Statuscode 403 beantwortet
**Ergebnis**
```
{ "IsOk":true,
"Message":"",
"ErrorId":0,
"Data": {
"IsImportResult":true,
"ArticleNew":1,
"ArticleChanged":1,
"GroupNew":1,
"GroupChanged":1,
"ExtraOptionNew":0,
"ExtraOptionChanged":0,
"ErrorList":null}
}
```
·