├── README.md └── api-referens.md /README.md: -------------------------------------------------------------------------------- 1 | # ICA inofficiellt API 2 | 3 | > [!WARNING] 4 | > **Uppdatering 17 april 2024:** Tyvärr har ICA gjort ändringar i sitt API så dokumentationen här är inte längre korrekt. Mer information finns i [detta ärende](https://github.com/svendahlstrand/ica-api/issues/26). 5 | 6 | ICA har en [smart app](http://www.ica.se/smarta-mattjanster/icas-appar/ica-handla/) 7 | som låter dig se ditt saldo, dina erbjudanden, göra inköpslistor med mera. Appen 8 | är backad av ett API som jag har börjat dokumentera här. Börja med att följa 9 | [kom igång-guiden](https://github.com/svendahlstrand/ica-api#kom-igng-hmta-information-om-ditt-konto) 10 | och ta sedan en titt på [API-referensen](https://github.com/svendahlstrand/ica-api/blob/master/api-referens.md). 11 | 12 | Dokumentationen är långt ifrån komplett och du får gärna hjälpa till, skicka bara 13 | en Pull Request. 14 | 15 | ## Kom igång: hämta information om ditt konto 16 | 17 | Här visar jag hur du enkelt kommer igång genom att hämta information om ditt 18 | konto, saldo och dina rabatter. 19 | 20 | ### Skaffa användarnamn och lösenord 21 | 22 | Du behöver ett användarnamn (ditt personnummer) och det lösenord som skickas 23 | ut på ditt bonusbesked med tidningen Buffé varje månad. Orkar du inte vänta en 24 | månad? [Kontakta ICA](http://www.ica.se/kundtjanst/fraga-ica) så skickar de 25 | lösenordet med post. 26 | 27 | ### Använd din favorit-klient 28 | 29 | När du testar API:et är det smidigt att ha en REST-klient. Jag rekommenderar: 30 | 31 | * [Postman](http://www.getpostman.com) (Chrome-app) 32 | * [rest-client](https://code.google.com/p/rest-client) (Java-baserad) 33 | * [curl](http://curl.haxx.se) (För terminal-nörden) 34 | 35 | I denna guide använder jag `curl` för att kunna visa exempel på ett enkelt sätt. 36 | 37 | ### Bas-URL 38 | 39 | Du kommer åt API:et över HTTPS på domänen `handla.api.ica.se`. 40 | 41 | ### Skaffa en AuthenticationTicket 42 | 43 | Först och främst behövs en `AuthenticationTicket` som används för att tala om 44 | vem du är. Den får du genom ett `GET`-anrop till `/api/login`. Skicka med 45 | använarnamn och lösenord med hjälp av HTTP Basic authentication. 46 | 47 | ```bash 48 | $ curl -i -u 7001011234:567 https://handla.api.ica.se/api/login/ 49 | HTTP/1.1 200 OK 50 | Cache-Control: no-cache 51 | Pragma: no-cache 52 | Content-Type: application/json; charset=utf-8 53 | Expires: -1 54 | Server: Microsoft-IIS/7.5 55 | AuthenticationTicket: 8D66EA[..] 56 | SessionTicket: 4F1E80[..] 57 | LogoutKey: 59068e[..] 58 | X-AspNet-Version: 4.0.30319 59 | X-Powered-By: ASP.NET 60 | Date: Sun, 07 Apr 2013 18:44:24 GMT 61 | Content-Length: 55 62 | {"FirstName":"John","LastName":"Doe","Ttl":1200} 63 | ``` 64 | 65 | Bland svarets response headers hittar du din `AuthenticationTicket`. Spar den 66 | till nästföljande anrop. 67 | 68 | ### Ställ en fråga om ditt konto 69 | 70 | Nu ha du allt som behövs för att ställa frågor till API:et. Prova ett `GET`-anrop 71 | till `/api/user/cardaccounts` och skicka med din `AuthenticationTicket` som en 72 | request header. 73 | 74 | ```bash 75 | $ curl \ 76 | -H 'AuthenticationTicket: 8D66EA[..]' \ 77 | https://handla.api.ica.se/api/user/cardaccounts/ 78 | HTTP/1.1 200 OK 79 | Cache-Control: no-cache 80 | Pragma: no-cache 81 | Content-Type: application/json; charset=utf-8 82 | Expires: -1 83 | Instance: ABCVM4242A 84 | Date: Mon, 15 Jun 2020 09:07:19 GMT 85 | Content-Length: 166 86 | 87 | {"CustomerNumber":123456789,"Cards":[{"Accounts":[],"CardTypeDescription":"ICA Kundkort utan betala","CardTypeCode":"90","MaskedCardNumber":"1234","Selected":false}]} 88 | ``` 89 | 90 | Svaret får du i JSON. Här ser du till exempel de kundkort du har registrerade på din användare. 91 | 92 | ### Nästa steg 93 | 94 | Grattis, nu är du klar med guiden! Titta gärna på [API-referensen](https://github.com/svendahlstrand/ica-api/blob/master/api-referens.md) 95 | för att komma vidare. Dokumentationen är under uppbyggnad och du får gärna 96 | hjälpa till. 97 | -------------------------------------------------------------------------------- /api-referens.md: -------------------------------------------------------------------------------- 1 | # API-referens 2 | 3 | Dokumentationen följer en konvention för att visa frågorna till och svaren från 4 | API:et. 5 | 6 | * `GET /api/login` HTTP-metod och URL:en till en resurs 7 | * `> Authorization: Basic ODYwNzE5NTkxMTo1NjM=` Request header 8 | * `< 200` HTTP-statuskod 9 | * `< AuthenticationTicket: 225DC3[..]` Response header 10 | 11 | Response body: 12 | 13 | ```json 14 | { 15 | "FirstName": "John", 16 | "LastName": "Doe", 17 | "Ttl": 1200 18 | } 19 | ``` 20 | 21 | ## Åtkomst 22 | 23 | Du kommer åt API:et över HTTPS på domänen `handla.api.ica.se`. All data skickas 24 | och tas emot som JSON. För de flesta anrop behöver tala om vem du är med hjälp 25 | av en AuthenticationTicket. 26 | 27 | # Anrop 28 | 29 | ## Innehållsförteckning 30 | 31 | - [Autentisering](#autentisering) 32 | - `GET` /api/login 33 | - [Kort](#kort) 34 | - `GET` /api/user/cardaccounts 35 | - [Min Bonus](#min-bonus) 36 | - `GET` /api/user/minbonustransaction 37 | - [Affärer](#affärer) 38 | - `GET` /api/user/stores 39 | - `GET` /api/stores/1 40 | - `GET` /api/stores/?LastSyncDate={timestamp} 41 | - `GET` /api/stores/search?Filters&Phrase={phrase} 42 | - [Erbjudanden](#erbjudanden) 43 | - `GET` /api/offers?Stores=XXXX 44 | - [Inköpslistor](#inköpslistor) 45 | - [Artikelgrupper](#artikelgrupper) 46 | - `GET` /api/articles/articlegroups?lastsyncdate={timestamp} 47 | - [Vanliga artiklar](#vanliga-artiklar) 48 | - `GET` /api/user/commonarticles/ + Request + Response 49 | - [Recept](#recept) 50 | - `GET` /api/user/recipes 51 | - `GET` /api/recipes/searchwithfilters?phrase={phrase}&recordsPerPage=x&pageNumber=x&sorting=x 52 | - `GET` /api/recipes/search/filters 53 | - `GET` /api/recipes/recipe/XXXXXX 54 | - `GET` /api/recipes/XXXXXX/rating 55 | - `GET` /api/recipes/random?numberofrecipes=x 56 | - [Receptkategorier](#receptkategorier) 57 | - `GET` /api/recipes/categories/general 58 | - `GET` /api/recipes/categories/general/{categoryId}?RecordsPerPage=x&PageNumber=x&Include=ImageId,Title,CookingTime,AverageRating,OfferCount,- IngredientCount 59 | - `GET` /api/recipes/categories/general/X?PageNumber=X&RecordsPerPage=X 60 | - [Strekkodssökning](#strekkodssökning) 61 | - `GET` /api/upclookup 62 | 63 | ## Autentisering 64 | ### `GET` /api/login 65 | 66 | Används för att få tag i en `AuthenticationTicket` som behövs för att tala om 67 | vem du är när du gör anrop till servern. 68 | 69 | Du använder HTTP Basic authentication med användarnamn och lösenord som du 70 | [skaffar hos ICA](https://github.com/svendahlstrand/ica-api#skaffa-användarnamn-och-lösenord). 71 | 72 | ``` 73 | GET /api/login 74 | > Authorization: Basic ODYwNzE4NTlxMSo1NjM= 75 | < 200 76 | < AuthenticationTicket: 225DC3[..] 77 | < SessionTicket: 8EEA5E[..] 78 | < LogoutKey: 7f9570[..] 79 | ``` 80 | ```json 81 | { 82 | "FirstName": "John", 83 | "LastName": "Doe", 84 | "Ttl": 1200 85 | } 86 | ``` 87 | 88 | ## Kort 89 | 90 | ### `GET` /api/user/cardaccounts 91 | 92 | Visa vilka kort som är registrerade för den inloggade användaren. 93 | 94 | ``` 95 | GET /api/user/cardaccounts 96 | > AuthenticationTicket: 225DC3[..] 97 | < 200 98 | ``` 99 | ```json 100 | { 101 | "CustomerNumber": 123456, 102 | "Cards": [ 103 | { 104 | "Accounts": null, 105 | "CardTypeDescription": "ICA KUNDKORT UTAN BETALA", 106 | "CardTypeCode": "90", 107 | "MaskedCardNumber": "0123", 108 | "Selected": false 109 | } 110 | ] 111 | } 112 | ``` 113 | 114 | ## Min Bonus 115 | ### `GET` /api/user/minbonustransaction 116 | 117 | Visar tidigare köp du gjort i ICA-butiker. 118 | 119 | ``` 120 | GET /api/user/minbonustransaction 121 | > AuthenticationTicket: 225DC3[..] 122 | < 200 123 | ``` 124 | ```json 125 | { 126 | "TransactionSummaryByMonth": [ 127 | { 128 | "Year": "2019", 129 | "Month": "6", 130 | "YearMonthAsDateTime": "2019-06-01T00:00:00", 131 | "TransactionForAMonth": [ 132 | { 133 | "TransactionDate": "20190610", 134 | "MarketingName": "ICA Supermarket Ankeborg", 135 | "TotalDiscount": 0, 136 | "TransactionValue": 46.5 137 | } 138 | ] 139 | }, 140 | { 141 | "Year": "2019", 142 | "Month": "5", 143 | "YearMonthAsDateTime": "2019-05-01T00:00:00", 144 | "TransactionForAMonth": [ 145 | { 146 | "TransactionDate": "20190514", 147 | "MarketingName": "ICA Supermarket Ankeborg", 148 | "TotalDiscount": 0, 149 | "TransactionValue": 145.44 150 | } 151 | ] 152 | }, 153 | ... 154 | ] 155 | } 156 | ``` 157 | 158 | ## Affärer 159 | 160 | ### `GET` /api/user/stores 161 | 162 | De butiker som du oftast besöker. 163 | 164 | ``` 165 | GET /api/user/stores 166 | > AuthenticationTicket: 225DC3[..] 167 | < 200 168 | ``` 169 | ```json 170 | { 171 | "FavoriteStores": [1, 2, 3] 172 | } 173 | ``` 174 | 175 | ### `GET` /api/stores/1 176 | 177 | Information om en butik. 178 | 179 | ``` 180 | GET /api/stores/1 181 | > AuthenticationTicket: 225DC3[..] 182 | < 200 183 | ``` 184 | ```json 185 | { 186 | "Id": 1, 187 | "MarketingName": "ICA Nära Lill-ICA", 188 | "Address": { 189 | "Street": "Dalgatan 5", 190 | "Zip": "933 33", 191 | "City": "ARVIDSJAUR" 192 | }, 193 | "Phone": "0960-211 89", 194 | "Coordinates": { 195 | "Latitude": 65.59017, 196 | "Longitude": 19.19496 197 | }, 198 | "WebURL": "http://www.ica.se/butiker/nara/arvidsjaur/ica-nara-lill-ica-1/start/", 199 | "FacebookUrl": null, 200 | "FilterItems": [11, 7], 201 | "ProfileId": "04", 202 | "OpeningHours": { 203 | "Today": "12-20", 204 | "RegularHours": [{ 205 | "Title": "Mån-Fre", 206 | "Hours": "09-20" 207 | }, { 208 | "Title": "Lördag", 209 | "Hours": "09-18" 210 | }, { 211 | "Title": "Söndag", 212 | "Hours": "12-20" 213 | } 214 | ], 215 | "SpecialHours": [], 216 | "OtherOpeningHours": null 217 | } 218 | } 219 | ``` 220 | 221 | ### `GET` /api/stores/?LastSyncDate={timestamp} 222 | 223 | Visa ICA butiker. Ersätt {timestamp} med en tidsstämpel med formatet YYYY-MM-DD. 224 | 225 | **OBS! Tung request som returnerar mycket data!** 226 | 227 | ``` 228 | GET /api/stores/?LastSyncDate=2014-12-01 229 | > AuthenticationTicket: 225DC3[..] 230 | < 200 231 | ``` 232 | ```json 233 | { 234 | "Stores": [ 235 | { 236 | "Id": 1, 237 | "StoreName": "ICA Nära Lill-ICA", 238 | "Address": { 239 | "Street": "Dalgatan 5", 240 | "Zip": "933 33", 241 | "City": "ARVIDSJAUR" 242 | }, 243 | "Coordinates": { 244 | "Latitude": 65.59017, 245 | "Longitude": 19.19496 246 | }, 247 | "IsActive": true, 248 | "ProfileId": "04", 249 | "ShoppingRound": "12,4,3,6,10,5,9,11,7,8", 250 | "ShoppingRoundType": 1, 251 | "DefaultShoppingRound": true, 252 | "StoreMapActive": false 253 | }, 254 | ... 255 | ] 256 | } 257 | ``` 258 | 259 | ### `GET` /api/stores/search?Filters&Phrase={phrase} 260 | 261 | Sök efter ICA butiker, ersätt {phrase} med ett sökord. 262 | 263 | ``` 264 | GET /api/stores/search?Filters&Phrase=lidköping 265 | > AuthenticationTicket: 225DC3[..] 266 | < 200 267 | ``` 268 | ```json 269 | { 270 | "Stores": [ 271 | 2043, 272 | 2050, 273 | 2044, 274 | 2046, 275 | 2014 276 | ] 277 | } 278 | ``` 279 | 280 | ## Erbjudanden 281 | 282 | ### `GET` /api/offers?Stores=XXXX 283 | 284 | Listar dina erbjudanden och kuponger. Det går att skicka in flera butiks id. Separera då med komma. 285 | 286 | ``` 287 | GET /api/offers?Stores=1595 288 | > AuthenticationTicket: 225DC3[..] 289 | < 200 290 | ``` 291 | ```json 292 | { 293 | "Offers": [ 294 | { 295 | "OfferId": "1000222315", 296 | "StoreId": 1595, 297 | "StoreIds": [ 298 | 1595 299 | ], 300 | "ArticleGroupId": 9, 301 | "OfferType": "handelsestyrd_ekupong", 302 | "ImageUrl": "http://extbild.ica.se/PictureWeb/80/54/14_1000222315.jpg", 303 | "PriceComparison": null, 304 | "SizeOrQuantity": "AXA , 375-500 g", 305 | "ProductName": "Havreflakes/Apple&Cinnamon", 306 | "OfferTypeTitle": "Kupong från Maxi ICA Stormarknad", 307 | "Disclaimer": "Max 1 st. Gäller 18/4-27/10. Lokalt kan avvikelser i sortiment förekomma.", 308 | "OfferCondition": "50% Lägre pris", 309 | "LoadedOnCard": true, 310 | "OfferUsed": true, 311 | "Expired": false, 312 | "Articles": [ 313 | { 314 | "EanId": "7310130002663", 315 | "ArticleDescription": "Havreflakes/Apple&Cinnamon" 316 | }, 317 | { 318 | "EanId": "7310130003578", 319 | "ArticleDescription": "Havreflakes/Apple&Cinnamon" 320 | } 321 | ] 322 | }, 323 | { 324 | ... 325 | } 326 | ] 327 | } 328 | ``` 329 | 330 | ## Inköpslistor 331 | 332 | ### `GET` /api/user/offlineshoppinglists 333 | 334 | Hämta alla inköpslistor. 335 | 336 | ###### Request 337 | ``` 338 | GET /api/user/offlineshoppinglists 339 | > AuthenticationTicket: [...] 340 | < 200 341 | ``` 342 | 343 | ###### Response 344 | ```json 345 | { 346 | "ShoppingLists": [ 347 | { 348 | "Id": 1, 349 | "Title": "Handla 08 januari", 350 | "CommentText": "", 351 | "SortingStore": 0, 352 | "Rows": [ 353 | { 354 | "RowId": 1, 355 | "ProductName": "Wrap tortilla", 356 | "Quantity": 0.000, 357 | "SourceId": 1, 358 | "IsStrikedOver": false, 359 | "InternalOrder": 1, 360 | "ArticleGroupId": 9, 361 | "ArticleGroupIdExtended": 9, 362 | "LatestChange": "2021-01-08T16:25:01Z", 363 | "OfflineId": "xxxxxx", 364 | "IsSmartItem": false 365 | } 366 | ], 367 | "LatestChange": "2021-01-08T16:25:05Z", 368 | "OfflineId": "xxxxxx", 369 | "IsPrivate": false, 370 | "IsSmartList": false 371 | } 372 | ] 373 | } 374 | ``` 375 | 376 | ### `GET` /api/user/offlineshoppinglists/\ 377 | 378 | Hämta en specifik inköpslista. Lägg märke till att `OfflineId` måste användas i URLen och inte `Id`. 379 | 380 | ###### Request 381 | ``` 382 | GET /api/user/offlineshoppinglists/\ 383 | > AuthenticationTicket: [...] 384 | < 200 385 | ``` 386 | 387 | ###### Response 388 | ```json 389 | { 390 | "Id": 1, 391 | "Title": "Handla 08 januari", 392 | "CommentText": "", 393 | "SortingStore": 0, 394 | "Rows": [ 395 | { 396 | "RowId": 1, 397 | "ProductName": "Wrap tortilla", 398 | "Quantity": 0.000, 399 | "SourceId": 1, 400 | "IsStrikedOver": false, 401 | "InternalOrder": 1, 402 | "ArticleGroupId": 9, 403 | "ArticleGroupIdExtended": 9, 404 | "LatestChange": "2021-01-08T16:25:01Z", 405 | "OfflineId": "xxxxxx", 406 | "IsSmartItem": false 407 | } 408 | ], 409 | "LatestChange": "2021-01-08T16:25:05Z", 410 | "OfflineId": "xxxxxx", 411 | "IsPrivate": false, 412 | "IsSmartList": false 413 | } 414 | ``` 415 | 416 | ### `POST` /api/user/offlineshoppinglists/\/sync 417 | 418 | Synka den lokala shoppinglistan till servern. Produkter med `"SourceId": -1` är produkter som ännu inte finns på servern. 419 | 420 | ###### Request 421 | ``` 422 | POST /api/user/offlineshoppinglists/\/sync 423 | > AuthenticationTicket: [...] 424 | < 200 425 | ``` 426 | 427 | ```json 428 | { 429 | "Id": 1, 430 | "Title": "Handla 08 januari", 431 | "CommentText": "", 432 | "SortingStore": 0, 433 | "Rows": [ 434 | { 435 | "RowId": 1, 436 | "ProductName": "Wrap tortilla", 437 | "Quantity": 0.000, 438 | "SourceId": 1, 439 | "IsStrikedOver": false, 440 | "InternalOrder": 2, 441 | "ArticleGroupId": 9, 442 | "ArticleGroupIdExtended": 9, 443 | "LatestChange": "2021-01-08T21:42:52Z", 444 | "OfflineId": "xxxxxx", 445 | "IsSmartItem": false 446 | }, 447 | { 448 | "RowId": 1, 449 | "ProductName": "Banan", 450 | "Quantity": 0.000, 451 | "SourceId": -1, 452 | "IsStrikedOver": false, 453 | "InternalOrder": 3, 454 | "ArticleGroupId": 4, 455 | "ArticleGroupIdExtended": 4, 456 | "ProductEan": "", 457 | "LatestChange": "2021-01-08T21:42:52Z", 458 | "OfflineId": "xxxxxx", 459 | "IsSmartItem": false 460 | } 461 | ], 462 | "LatestChange": "2021-01-08T21:42:52Z", 463 | "OfflineId": "xxxxxx", 464 | "IsPrivate": false, 465 | "IsSmartList": false 466 | } 467 | ``` 468 | 469 | ###### Response 470 | ```json 471 | { 472 | "Id": 1, 473 | "Title": "Handla 08 januari", 474 | "CommentText": "", 475 | "SortingStore": 0, 476 | "Rows": [ 477 | { 478 | "RowId": 1, 479 | "ProductName": "Wrap tortilla", 480 | "Quantity": 0.000, 481 | "SourceId": 1, 482 | "IsStrikedOver": false, 483 | "InternalOrder": 2, 484 | "ArticleGroupId": 9, 485 | "ArticleGroupIdExtended": 9, 486 | "LatestChange": "2021-01-08T21:42:52Z", 487 | "OfflineId": "xxxxxx", 488 | "IsSmartItem": false 489 | }, 490 | { 491 | "RowId": 1, 492 | "ProductName": "Banan", 493 | "Quantity": 0.000, 494 | "SourceId": 0, 495 | "IsStrikedOver": false, 496 | "InternalOrder": 3, 497 | "ArticleGroupId": 4, 498 | "ArticleGroupIdExtended": 4, 499 | "ProductEan": "", 500 | "LatestChange": "2021-01-08T21:42:52Z", 501 | "OfflineId": "xxxxxx", 502 | "IsSmartItem": false 503 | } 504 | ], 505 | "LatestChange": "2021-01-08T21:42:52Z", 506 | "OfflineId": "xxxxxx", 507 | "IsPrivate": false, 508 | "IsSmartList": false 509 | } 510 | ``` 511 | 512 | ### `POST` /api/user/offlineshoppinglists 513 | 514 | Skapa en ny inköpslista. 515 | 516 | ###### Request 517 | ``` 518 | POST /api/user/offlineshoppinglists 519 | > AuthenticationTicket: [...] 520 | < 200 521 | ``` 522 | 523 | ```json 524 | { 525 | "OfflineId": "xxxxxx", 526 | "Title": "Min fina inköpslista", 527 | "CommentText": "", 528 | "SortingStore": 0, 529 | "Rows": [], 530 | "LatestChange": "2021-01-08T22:52:33Z" 531 | } 532 | ``` 533 | 534 | ###### Response 535 | ```json 536 | { 537 | "Id": 1 538 | } 539 | ``` 540 | 541 | ### `DELETE` /api/user/offlineshoppinglists/ 542 | 543 | Ta bort en inköpslista. 544 | 545 | ###### Request 546 | ``` 547 | DELETE /api/user/offlineshoppinglists/ 548 | > AuthenticationTicket: [...] 549 | < 200 550 | ``` 551 | 552 | ###### Response 553 | ``` 554 | No content 555 | ``` 556 | 557 | ## Artikelgrupper 558 | 559 | ### `GET` /api/articles/articlegroups?lastsyncdate={timestamp} 560 | 561 | Hämta alla artikelgrupper sedan ett visst datum. 562 | 563 | ###### Request 564 | ``` 565 | GET/api/articles/articlegroups?lastsyncdate=2001-01-01 566 | > AuthenticationTicket: [...] 567 | < 200 568 | ``` 569 | 570 | ###### Response 571 | ```json 572 | { 573 | "ArticleGroups": [ 574 | { 575 | "Id": 3, 576 | "Name": "Bröd, kex och bageri", 577 | "ParentId": 1, 578 | "LastSyncDate": "2015-09-18T08:45:55" 579 | }, 580 | { 581 | "Id": 4, 582 | "Name": "Frukt & Grönt", 583 | "ParentId": 1, 584 | "LastSyncDate": "2015-06-02T15:03:20" 585 | }, 586 | // [...] 587 | ] 588 | } 589 | ``` 590 | 591 | ## Vanliga Artiklar 592 | 593 | ### `GET` /api/user/commonarticles/ 594 | 595 | Hämtar en lista på frekvent använda varor 596 | 597 | ###### Request 598 | ``` 599 | GET /api/user/commonarticles/ 600 | > AuthenticationTicket: [..] 601 | ``` 602 | 603 | ###### Response 604 | ``` 605 | < 200 606 | < Content-Type: application/json 607 | ```` 608 | 609 | ```json 610 | { 611 | "CommonArticles": [ 612 | { 613 | "Id": 7601571, 614 | "ProductName": "Bröd", 615 | "ArticleId": 10241, 616 | "ArticleGroupId": 3, 617 | "ArticleGroupIdExtended": 3, 618 | "FormatCategoryMaxi": "2217", 619 | "FormatCategoryKvantum": "2217", 620 | "FormatCategorySuperMarket": "2217", 621 | "FormatCategoryNara": "2217" 622 | } 623 | ] 624 | } 625 | ``` 626 | 627 | ## Recept 628 | 629 | ### `GET` /api/user/recipes 630 | 631 | Ta fram användarens sparade recept. 632 | 633 | ``` 634 | GET /api/user/recipes 635 | > AuthenticationTicket: 225DC3[..] 636 | < 200 637 | ``` 638 | ```json 639 | { 640 | "RecipeIds": [ 641 | 720948, 642 | 720947, 643 | 721249 644 | ], 645 | "UserRecipes": [ 646 | { 647 | "RecipeId": 720948, 648 | "CreationDate": "2016-12-01T14:05:42" 649 | }, 650 | { 651 | "RecipeId": 720947, 652 | "CreationDate": "2016-12-01T14:05:42" 653 | }, 654 | { 655 | "RecipeId": 721249, 656 | "CreationDate": "2016-12-01T14:05:42" 657 | } 658 | ] 659 | } 660 | ``` 661 | 662 | ### `GET` /api/recipes/searchwithfilters?phrase={phrase}&recordsPerPage=x&pageNumber=x&sorting=x 663 | 664 | Sök efter recept. Ersätt {phrase} med sökord i recept du söker efter. 665 | 666 | ``` 667 | GET /api/recipes/searchwithfilters?recordsPerPage=40&pageNumber=1&phrase=pizza&sorting=0 668 | > AuthenticationTicket: [...] 669 | < 200 670 | ``` 671 | ``` 672 | { 673 | "NumberOfPages": 4, 674 | "Recipes": [ 675 | { 676 | "Id": 714168, 677 | "ImageId": 42438, 678 | "ImageUrl": "" 679 | "Title": "Pizza", 680 | "PreambleHTML": null, 681 | "CookingTime": "Under 30 minuter", 682 | "CookingTimeMinutes": 30, 683 | "AverageRating": "3.0", 684 | "CommentCount": 0, 685 | "AverageRating": "4.3" 686 | "IngredientCount": 7, 687 | "OfferCount": 0 688 | }, 689 | ... 690 | ], 691 | "TotalNumberOfRecipes": 142, 692 | "Msg": "" 693 | } 694 | ``` 695 | 696 | ### `GET` /api/recipes/search/filters 697 | 698 | Lista receptfilter. 699 | 700 | ``` 701 | GET /api/recipes/search/filters 702 | < 200 703 | ``` 704 | ```json 705 | { 706 | "FilterItems": [ 707 | { 708 | "Id": 2, 709 | "ImageId": null, 710 | "SelectedImageId": null, 711 | "Name": "Förrätt" 712 | }, 713 | { 714 | "Id": 3, 715 | "ImageId": null, 716 | "SelectedImageId": null, 717 | "Name": "Efterrätt" 718 | }, 719 | { 720 | "Id": 4, 721 | "ImageId": null, 722 | "SelectedImageId": null, 723 | "Name": "Huvudrätt" 724 | }, 725 | ... 726 | ] 727 | } 728 | ``` 729 | 730 | ### `GET` /api/recipes/recipe/XXXXXX 731 | 732 | Information om ett recept. 733 | 734 | ``` 735 | GET /api/recipes/recipe/713666 736 | < 200 737 | ``` 738 | ```json 739 | { 740 | "Id": 713666, 741 | "Title": "Pastagratäng med kryddiga korvar", 742 | "ImageId": 35482, 743 | "YouTubeId": null, 744 | "IngredientGroups": [ 745 | { 746 | "GroupName": "Ingredienser", 747 | "Ingredients": [ 748 | { 749 | "Text": "4 port pastaskruvar", 750 | "IngredientId": 11210, 751 | "Quantity": 4, 752 | "Unit": null, 753 | "Ingredient": "port pastaskruvar" 754 | }, 755 | { 756 | ... 757 | } 758 | ] 759 | }, 760 | { 761 | ... 762 | } 763 | ], 764 | "PreambleHTML": "Recept på enkel och matig pastagratäng med kryddiga korvar som tillagas i ugn.", 765 | "CurrentUsersRating": null, 766 | "AverageRating": 3, 767 | "Difficulty": "Medel", 768 | "CookingTime": "Under 60 min", 769 | "Portions": 4 770 | } 771 | ``` 772 | ### `GET` /api/recipes/XXXXXX/rating 773 | 774 | Betyg från användare. 775 | 776 | ``` 777 | GET /api/recipes/716405/rating 778 | > AuthenticationTicket: [...] 779 | < 200 780 | ``` 781 | ```json 782 | { 783 | "CurrentUserRating": 0 784 | } 785 | ``` 786 | 787 | ### `GET` /api/recipes/random?numberofrecipes=x 788 | 789 | Hämtar slumpvist utvalda recept. 790 | 791 | ``` 792 | GET /api/recipes/random?numberofrecipes=1 793 | < 200 794 | ``` 795 | ```json 796 | { 797 | "Id": 713666, 798 | "Title": "Pastagratäng med kryddiga korvar", 799 | "ImageId": 35482, 800 | "YouTubeId": null, 801 | "IngredientGroups": [ 802 | { 803 | "GroupName": "Ingredienser", 804 | "Ingredients": [ 805 | { 806 | "Text": "4 port pastaskruvar", 807 | "IngredientId": 11210, 808 | "Quantity": 4, 809 | "Unit": null, 810 | "Ingredient": "port pastaskruvar" 811 | }, 812 | { 813 | ... 814 | } 815 | ] 816 | }, 817 | { 818 | ... 819 | } 820 | ], 821 | "PreambleHTML": "Recept på enkel och matig pastagratäng med kryddiga korvar som tillagas i ugn.", 822 | "CurrentUsersRating": null, 823 | "AverageRating": 3, 824 | "Difficulty": "Medel", 825 | "CookingTime": "Under 60 min", 826 | "Portions": 4 827 | } 828 | ``` 829 | 830 | ## Receptkategorier 831 | 832 | ### `GET` /api/recipes/categories/general 833 | 834 | Listar namn på recept kategorier. 835 | 836 | ``` 837 | GET /api/recipes/categories/general 838 | < 200 839 | ``` 840 | ```json 841 | { 842 | "Categories": [ 843 | { 844 | "Id": 7, 845 | "Title": "Billiga Veckan" 846 | }, 847 | { 848 | "Id": 36, 849 | "Title": "Grillrecept" 850 | }, 851 | { 852 | "Id": 37, 853 | "Title": "Sallader" 854 | }, 855 | { 856 | "Id": 24, 857 | "Title": "Grönare middagar" 858 | }, 859 | { 860 | "Id": 19, 861 | "Title": "Vegetariska recept" 862 | }, 863 | { 864 | "Id": 39, 865 | "Title": "Jordgubbar" 866 | }, 867 | { 868 | "Id": 11, 869 | "Title": "Soppor" 870 | }, 871 | { 872 | "Id": 21, 873 | "Title": "Fisk" 874 | }, 875 | { 876 | "Id": 10, 877 | "Title": "Kyckling" 878 | }, 879 | { 880 | "Id": 12, 881 | "Title": "Paj" 882 | }, 883 | { 884 | "Id": 13, 885 | "Title": "Lasagne" 886 | }, 887 | { 888 | "Id": 35, 889 | "Title": "Bakverk" 890 | }, 891 | { 892 | "Id": 31, 893 | "Title": "Frukost" 894 | }, 895 | { 896 | "Id": 25, 897 | "Title": "Smoothies" 898 | }, 899 | { 900 | "Id": 9, 901 | "Title": "Tårta" 902 | }, 903 | { 904 | "Id": 3, 905 | "Title": "Tidningen Buffé" 906 | }, 907 | { 908 | "Id": 14, 909 | "Title": "Grytor" 910 | } 911 | ] 912 | } 913 | ``` 914 | 915 | ### `GET` /api/recipes/categories/general/{categoryId}?RecordsPerPage=x&PageNumber=x&Include=ImageId,Title,CookingTime,AverageRating,OfferCount,IngredientCount 916 | 917 | Visa recept i kategori. Ersätt {categoryId} med id från en av kategorierna från endpoint ovan. 918 | 919 | ``` 920 | GET /api/recipes/categories/general/88?RecordsPerPage=30&PageNumber=1&Include=ImageId,Title,CookingTime,AverageRating,OfferCount,IngredientCount 921 | > AuthenticationTicket: [...] 922 | < 200 923 | ``` 924 | ``` 925 | { 926 | "CategoryName": "Lax", 927 | "NumberOfPages": 31, 928 | "Recipes": [ 929 | { 930 | "Id": 688127, 931 | "ImageId": 79179, 932 | "Title": "Ugnsbakad lax med limecrème fraiche", 933 | "PreambleHTML": null, 934 | "Difficulty": null, 935 | "CookingTime": "Under 30 minuter", 936 | "AverageRating": "4", 937 | "IngredientCount": 12, 938 | "OfferCount": 1 939 | }, 940 | ... 941 | ], 942 | "TotalNumberOfRecipes": 915 943 | } 944 | ``` 945 | 946 | ### `GET` /api/recipes/categories/general/X?PageNumber=X&RecordsPerPage=X 947 | 948 | Recept i kategori. 949 | 950 | ``` 951 | GET /api/recipes/categories/general/7?PageNumber=1&RecordsPerPage=50 952 | < 200 953 | ``` 954 | ```json 955 | { 956 | "CategoryName": "Billiga Veckan", 957 | "NumberOfPages": 15, 958 | "Recipes": [ 959 | { 960 | "Id": 716500, 961 | "ImageId": 77140, 962 | "Title": "Färskpotatissallad med cajunkorv" 963 | }, 964 | { 965 | "Id": 716501, 966 | "ImageId": 77142, 967 | "Title": "Kycklingpanna med timjan" 968 | }, 969 | { 970 | ... 971 | } 972 | ] 973 | } 974 | ``` 975 | 976 | ## Strekkodssökning 977 | 978 | ### `GET` /api/upclookup 979 | 980 | Efterfråga artikelinformation för en EAN-kod. Informationen är mycket kortfattad men kan räcka för sökning, inköpslistor och så vidare. 981 | 982 | Det går att fråga om flera artiklar på en gång, a la "7310390001383,7310751163903". Items innehåller då ett element per artikel. 983 | 984 | ``` 985 | GET /api/upclookup?upc=7313350007203 986 | > AuthenticationTicket: [...] 987 | < 200 988 | ``` 989 | ```json 990 | { 991 | "Items": [ 992 | { 993 | "Upc": "7313350007203", 994 | "ItemDescription": "Knäcke runda Original 280g Polarbröd", 995 | "ArticleGroup": 3, 996 | "ArticleGroupExtended": 3, 997 | "FormatCategoryMaxi": "1270.10", 998 | "FormatCategoryKvantum": "1270.10", 999 | "FormatCategorySuperMarket": "1270.10", 1000 | "FormatCategoryNara": "1270.10", 1001 | "ProductGroup": { 1002 | "Category": "Bröd, kex & bageri", 1003 | "SubCategory": "Knäckebröd", 1004 | "Suggestion": "knäcke" 1005 | } 1006 | } 1007 | ] 1008 | } 1009 | ``` 1010 | --------------------------------------------------------------------------------