This API only supports JSON responses; check your Accept header

I’m connecting via the HTTP Make an OAuth 2.0 module to our ChurchCRM system. The connection settings are correct in that it does connect, but I get an error message that says
“{“error”:{“status”:406,“message”:“This API only supports JSON responses; check your Accept header.”}}”
I’m learning on these things. Am I correct in that I should include Accept: application/json in the header, and if so can someone please advise, as I’ve not been success in this.

Thanks in advance

Hi @Justyn_Pride
Correct and if you’re sending a JSON data to the API endpoint you should also specify the Content-Type: application/json header. You can do it in Make by selecting the Raw body type and Conte type JSON (application/json)

Thanks for the reply. I’m not getting beyond the ‘creating a connection’ part of the module. It’s where I then get the error message:



@Justyn_Pride I checked their API docs and in both cases (API token and OAuth) you should reach out their support - support@churchsuite.com.
GitHub - ChurchSuite/churchsuite-api: API documentation for ChurchSuite https://churchsuite.com
I think it’s easier to request the API token then setup the OAuth.

Thanks. I’ll make contact with them. I had to do that to get early access to the OAuth API which is in development. I was hoping this would be easier than being on the old API. maybe not…

Welcome to the Make Community!

The authorise URI doesn’t seem correct.

Please refer to their API documentation for the correct URL.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

You are correct on the authorise Url. I’ve had some more specifics from the system developer:

From the look of those screenshots, it looks to me as though you’re trying to authorise using the Authorisation Code OAuth2 grant - because you’ve put api.churchsuite.com/v2 in the “Authorize URL” box, it will try and redirect your browser there to get you to manually log in, which is returning the error you have seen, because our API routes are JSON-only.

Our v2 API currently only supports the Client Credentials grant, so you’ll need to follow a slightly different flow to get an Auth token - we’ve got an explanation and example here https://developer.churchsuite.com/auth that will hopefully help. I had a quick look at Make, and I couldn’t see anything that looked like it had a premade Client Credentials grant setup, but presumably it has the facility to make a sequence of HTTP requests, which is all you really need to implement it yourself - you make a request to login.churchsuite.com/oauth2/token with the right parameters and your API client ID/secret as Basic Auth, and you’ll get a Bearer Token back that you can then use with the API.

It does sound like I’d need to make two requests? Any thoughts and recommendations appreciated.

Update, I that I’ve being trying a solution found here - Using Grant Type "Client Credentials" for OAuth2 in HTTP app - #17 by Richard_Johannes

The feedback I’ve had from the system developer is that the parameters look good, but the body of the request is invalid, which is why I’ve been seeing the validation error - the “data” key in your request isn’t valid JSON on my latest attempt. The request content field is correct but is not being passed through as correct JSON. The form is:

But the invalid JSON output is:

{\ngrant_type:"client_credentials",\nclient_id:"XXXXXX",\nclient_secret:"XXXXXX",\nscope:"full_access",\n}

Valid JSON should be:

{“grant_type”:“client_credentials”,“client_id”:“XXXXXX”,“client_secret”:“XXXXXX”,“scope”:“full_access”}

Feels so close to solving this one.