Ich versuche Bestellungen mittels _action-Methode vom Status “offen” auf “in Bearbeitung” zu patchen, erhalte aber den StatusCode: MethodNotAllowed zurück.
Ich habe meinen Aufruf verglichen mit dem, welcher das Backend erzeugt, wenn der Status manuell geändert wird und kann ausser der API-Version (habe es mit v2 und v3 versucht) keinen Unterschied erkennen.
Hier die komplette Response (inkl RequestMessage):
{StatusCode: 405, ReasonPhrase: 'Method Not Allowed', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: Keep-Alive
Server: Apache
sw-language-id:
Transfer-Encoding: chunked
Keep-Alive: timeout=5, max=10
Cache-Control: private
Date: Tue, 17 Nov 2020 07:49:43 GMT
Vary: Authorization
X-Frame-Options: deny
X-Powered-By: PleskLin
sw-version-id:
Access-Control-Allow-Headers: Content-Type,Authorization,sw-context-token,sw-access-key,sw-language-id,sw-version-id,sw-inheritance,fail-on-error,indexing-behavior,single-operation,sw-include-seo-urls
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT,PATCH,DELETE
sw-context-token:
Content-Type: application/json
}}
Content: {System.Net.Http.StreamContent}
Headers: {Connection: Keep-Alive
Server: Apache
sw-language-id:
Transfer-Encoding: chunked
Keep-Alive: timeout=5, max=10
Cache-Control: private
Date: Tue, 17 Nov 2020 07:49:43 GMT
Vary: Authorization
X-Frame-Options: deny
X-Powered-By: PleskLin
sw-version-id:
Access-Control-Allow-Headers: Content-Type,Authorization,sw-context-token,sw-access-key,sw-language-id,sw-version-id,sw-inheritance,fail-on-error,indexing-behavior,single-operation,sw-include-seo-urls
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST,PUT,PATCH,DELETE
sw-context-token:
}
IsSuccessStatusCode: false
ReasonPhrase: "Method Not Allowed"
RequestMessage: {Method: PATCH, RequestUri: 'https://sw.webcrew.ch/api/v3/_action/order/ab639153cb6a4b1eb8dae906929a443b/state/process', Version: 2.0, Content: System.Net.Http.StringContent, Headers:
{
Accept: application/vnd.api+json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjBhYzJlYTMzNDQzMThjZTY3Mjc5YWYyMTg1ZGY0NmI2NmRhZjA5NjZjNmM2NGYwYzQ2Yjk2NGM1Y2IzMjE3ODM5NjA5ZjU5NGJlMWNhZjkwIn0.eyJhdWQiOiJhZG1pbmlzdHJhdGlvbiIsImp0aSI6IjBhYzJlYTMzNDQzMThjZTY3Mjc5YWYyMTg1ZGY0NmI2NmRhZjA5NjZjNmM2NGYwYzQ2Yjk2NGM1Y2IzMjE3ODM5NjA5ZjU5NGJlMWNhZjkwIiwiaWF0IjoxNjA1NTk5MzI0LCJuYmYiOjE2MDU1OTkzMjQsImV4cCI6MTYwNTU5OTkyNCwic3ViIjoiYzZiODE2MTU2Yjk2NGZhNzkxYWI5ZjA5MTUxODIzOWEiLCJzY29wZXMiOlsid3JpdGUiLCJhZG1pbiJdfQ.m5KBTsYM1j3TZsYOs5JJw07t7g2vMU1RLXguK9LQ0qyFFbnEBpw6E3bz2ezwqhKKn53eq-s6LUSwJvzeghiwBbH3QiLw9b2tO0fBN4i1T3gGXOm2gOztuon9UNkTof2n7F5ysweAGRLR_v38Fvpsr3yjzRzX-NdtBtQ4bJ9slp8IvmxBZd4uLT_ItCL2Gd6T0j4SbfFU5Kuj9UDWzJXDKUKk3ZRQvZH8OOOvMHR4KcEsPEdTg8ILIBRvSXgr43BJB1WVjHysfIqi9O9oifaOBqXu-sEnsGeL_ISq_gfNXI6Mk9MSLV4-iZhug5LJ0Wml3f1FRkIrFz2zHKWOg_Vlcg
Accept-Encoding: gzip
Accept-Encoding: deflate
Accept-Encoding: br
Content-Type: application/json; charset=utf-8
Content-Length: 47
}}
StatusCode: MethodNotAllowed
Version: {1.1}
Screenshot XHR - bei setzen des Status über das Backend von Shopware zum Vergleich:
Ich habe mich als völliger Shopware und REST-API Newbee schon ziemlich weit “vorgekämpft”, aber dabei stehe ich mal richtig auf dem Schlauch und frage mich was ich falsch mache.Jede Hilfe ist daher hoch willkommen.