Closed MarneeDear closed 4 years ago
Hey,
From the top of my head - api
pipeline plugs acceptJson
which means you need to specify application/json
in the Content-Type
header on your request
Thanks, @Krzysztof-Cieslak
Maybe I'm still doing this wrong. In Postman I set the Content-Type header to application/json like this:
curl --location --request GET 'https://localhost/mspe/cohorts/2020/students' \
--header 'X-API-Key: APIKeySecret' \
--header 'Content-Type: application/json'
And I get 404 not found. If I comment out the acceptJson plug, it does work.
I had to use the Accept header:
curl --location --request GET 'https://localhost/mspe/cohorts/2020/students' \
--header 'X-API-Key: APIKeySecret' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json'
I had this same problem recently.
Why would the API router demands this header Accept: application/json
after all? I did not get this.
I am trying to make the "api" code work using the Saturn template. I uncommented the API route code in the the router and made a few minor changes to get it to compile. When I make a request to that route, I get the 404 page.
Am I doing something wrong?
Here is my router: