What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hello all, I have added a POST route to my Glue resource (check the code below) ``` public function
Hello all, I have added a POST route to my Glue resource (check the code below)
public function configure(ResourceRouteCollectionInterface $resourceRouteCollection) : ResourceRouteCollectionInterface { // to get all pickup points $resourceRouteCollection->addGet('get', true); // to add a pickup point $resourceRouteCollection->addPost('post', true); // return $resourceRouteCollection; }
I send the following POST request to the endpoint using the PHPStorm Scratch file:
### POST <http://glue.de.spryker.local/addax-pickup-points/> Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJmcm9udGVuZCIsImp0aSI6ImZlYjI2OWZhMGI2OTBmMGM3ODY4ZTYzMGE0YzRjOGZhZWI5YjI1ZTNlZTdiY2NjYjcxZWU5YTEzNDYwYjU2NGY4MjliNGM4ZmYzZjRiYTc3IiwiaWF0IjoxNjY4NjgxMTc1LCJuYmYiOjE2Njg2ODExNzUsImV4cCI6MTY2ODcwOTk3NSwic3ViIjoie1wiaWRfYWdlbnRcIjpudWxsLFwiY3VzdG9tZXJfcmVmZXJlbmNlXCI6XCJERS0tMTZcIixcImlkX2N1c3RvbWVyXCI6MTZ9Iiwic2NvcGVzIjpbImN1c3RvbWVyIl19.3DSGl2f4Bs30ic6prumfYbN7iGweMeWyKs9XuObVCCnwxtkxPS2H4UNcZDr3_cLbNqtLW2PaU_N5raUjCI6bhjmiT0dAc2kkW6iFq_2MVsroQDALKe_odRb_ibAAgLIjGDXsAWFbaJ3lHk7qpDCNdqMwbvny0oQkVxc90aB6CPVqWXW_Yh4Gpl-zUJTD-NFM_XxDTSJax5Qtq80t7SZzEXKuPHVN7tOO8dGxUKMavgfU6vCZTqUrlRCskB7RG8ctCR3x6XLJzOuIEBWOUvDQsE_2DyiKTz9_ZzjRiDWqxOzlH6kIrT1Eph4-kSL0aOhGDWYBeFbc3z_kRENnZg6JkQ accept: application/json Content-Type: application/json { "data": { "idAddaxPickupPoint":"123", "shopName" : "Wolf Land", "address" : "Carl Zeiss Street 12", "city" : "Berlin", "country" : "Germany", "idNumber" : "123" } }
But I get the following error:
<http://glue.de.spryker.local/addax-pickup-points/> HTTP/1.1 400 Bad Request Server: nginx Date: Thu, 17 Nov 2022 13:41:04 GMT Content-Type: application/vnd.api+json Transfer-Encoding: chunked Connection: keep-alive Cache-Control: no-cache, private content-language: en_US X-Frame-Options: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self' X-Content-Type-Options: nosniff X-XSS-Protection: 1; mode=block Referrer-Policy: same-origin Strict-Transport-Security: max-age=31536000; includeSubDomains; preload { "errors": [ { "detail": "Post data is invalid.", "status": 400 } ] }
Can someone please advise?
Comments
-
Request body should be in JSON:API format:
{ "data": { "type": "<your resource type>", "id": "<id of resource>", "attributes": { "idAddaxPickupPoint":"123", "shopName" : "Wolf Land", "address" : "Carl Zeiss Street 12", "city" : "Berlin", "country" : "Germany", "idNumber" : "123" } } }
0 -
@UL6DGRULR Thank you. This works.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random