Where is API V2 Endpoint

Hello,

I can call API using Rest API with 200 code returned, but getting error 404 error using REST API V2.

  • REST API Endpoint:
    • https://{{YOURORG}}.atlassian.net/wiki/rest/api/search?cql=id != 0 order by lastmodified desc&limit=1
  • REST API V2 Endpoint: https://{{YOURORG}}.atlassian.net/wiki/api/v2/pages

I am using same HEADERS in Request.

Could you help me how to find endpoint for API V2?

Hello @LizaWu

You say you are getting a 404 error with the v2 REST API endpoint https://{{YOURORG}}.atlassian.net/wiki/api/v2/pages, yet that is a valid path to a valid endpoint.

  1. What are the headers in your request?
  2. What authentication method are you using?
  3. Are you able to access all the other v2 REST API endpoints?
  4. What coding language or environment / method are you using to encode the request?
  5. What test tools like Postman have you used to validate your request separately to your code?

Hi @sunnyape ,

  1. Header is {Accept:application/json
    Content-Type:application/json}
  2. Basic Auth: username/apitoken
  3. None of API V2 can be accessed
  4. Using Postman with Collection of REST API V2 from Confluence Developer website

Can you please provide the path to your Confluence Cloud instance. Please advise what the {{YOURORG}} value is in the path https://{{YOURORG}}.atlassian.net/

Can you also please provide a screen grab of the Postman session showing the full request, the request path, including any parameters you are supplying with the request, like this:

Also, for GET requests, you don’t need to set the Accept or Content-Type values in the header, those are for PUT and POST requests, so don’t set those values in Postman.

Hi @sunnyape ,

Here is log from Postman: GET https://seiu775bg.atlassian.net/wiki/api/v2/spaces 404 236 ms

When you access the v1 endpoint https://seiu775bg.atlassian.net/wiki/rest/api/space , apart from getting the 200 OK response, what is in the body of the response? Do you get the JSON body with a list of all the spaces?

Are all the v1 endpoints all working? If you can access v1 endpoints, such as https://seiu775bg.atlassian.net/wiki/rest/api/search, then there should be no reason why you can’t access the v2 endpoints using the same credentials.

Also, I feel obliged to warn you, that if you attempt to make a connection to certain v1 endpoints without valid authorisation, you will get a 403 or 401 error, but you you attempt to make a connection to certain v2 endpoints without valid authorisation, you will get a 404 error. I think you may be confusing that error telling you the endpoint doesn’t exist with the real cause of the problem… that you haven’t properly authenticated the request. This topic of the V2 endpoints providing ‘misleading’ error responses has already been discussed on this forum previously.

Hi @sunnyape ,

Thanks for your comment

After I used new token, the endpoint works.