GOAL endpoint returning 404 Not Found

Thanks @mykhailo this worked for GOAL endpoint, however I am getting OK text message but 404 Not Found error for GOAL_RESULT endpoint
Error message:-

{
    "success": true,
    "statusCode": 20000,
    "statusText": "OK",
    "service": "statistics-goals-api",
    "data": {
        "code": 404,
        "httpCode": 404,
        "message": "Not Found",
        "severity": 1
    }
}

Curl Request:-

curl -H 'Authorization: Bearer ******' -H 'Accept: application/json' -A 'Jersey/2.31' 'https://infrakit.pipedrive.com/api/v1/goals/6dde16a3442a2997bb505adc1f09513b/results?period.start=2010-06-21&period.end=2021-08-27'

Any idea why I am getting this error?

Hi @pm-fivetran

This error can happen if your period.start does not match Goal’s period start, as one cannot ask for results of a goal if the goal is not running during the specified period.

Thanks @mykhailo got it, So we can query GOAL_RESULT using duration.start and duration.end of a goal. So it means duration.start would always be not null.

Still for some goal_ids I am getting 500 internal server error, my period.start = goal.start and period.end = goal.end
Error message:

{
    "success": false,
    "statusCode": 10001,
    "statusText": "An unknown error occurred",
    "service": "statistics-goals-api"
}

Curl request:-

curl -H ‘Authorization: Bearer ****’ -H ‘Accept: application/json’ -A ‘Jersey/2.31’ ‘https://infrakit.pipedrive.com/api/v1/goals/0cf7d198b051d30aaad599e86500b376/results?period.start=2019-01-01&period.end=2019-12-31

Could you check if you can see stages of a pipeline where goal is connected to?

For example, here is my goal

And if I make GET /stages?pipeline_id=17, I get response

@mykhailo When I tried to make request /stages?pipeline_id=5 and response is 200 OK
But data is null

{
    "success": true,
    "data": null
}

Could you also try GET /pipelines/{id} (Pipedrive API v1 Reference)

If the response is 404 then the connected pipeline does not exist anymore and it breaks the API call.

*Messaging and logic can be improved for this case (notified a team already).

Actually /pipelines/5 is working and I am also able to get the data, its not giving 404

I double-checked one more time and it seems like it might fail for both cases, when a connected pipeline does not exist, or a connected pipeline exists but has no stages.

As your pipeline exists but has no stages, can you add a stage there and try again?

Thanks,@mykhailo. I am getting 403 FORBIDDEN error for the following tables:-


Does this table need some extra permissions?
Except for these

Hi @pm-fivetran, if not a regular user installs the app that uses admin’s APIs, in some cases a user can get 403.

I recently made an example for webhooks, Creating new webhooks through API - #8 by mykhailo which also might cover your case.

Also, 403 can happen when you try to call an endpoint with access token that has no access to that endpoint. For example, I see that you have something related to Leads, but you don’t have leads scope. Which means, when you call Leads endpoints you will get 403.

More about endpoints and permissions here

Hi @mykhailo I want to update the scopes you mentioned in my app.
Currently, my other endpoints are working fine, so when I update scopes in my app then would other endpoints also fail on 401 UnAuthorized error, or would they be working fine?

Hi @pm-fivetran

Here is what happens when an app gets new scopes.

so when I update scopes in my app then would other endpoints also fail on 401 UnAuthorized error, or would they be working fine?

They will be working fine, once you get a new access token with refresh_token, as the existing access token will be invalidated.

And in order to call new endpoints (in your case Leads endpoints), an app user has to re-authorize.

Thanks @mykhailo So just to confirm once I update the scopes other endpoints would succeed once we refresh token, customers wont need to re-authorise with app if they dont need these new endpoints

Yes, but as I mentioned before, existing access tokens will become invalid, similar to the case when they expire and need to be refreshed. Hence, your app should be able to handle this case, otherwise once a scope is added existing users will not be able to use the app without re-install.

If it’s still unclear, I do recommend creating another app, just for testing (no need to publish), and test that scenario there (no need in code, you can make requests with Postman for example). So you could see what happens with tokens before a scope is added and after.

@mykhailo Sure, thanks
Regarding your this reply, do you have some documentation which I can forward to our customer regarding how can we add stages in pipeline?

This page includes information on how to add/remove/re-order stages How can I customize my pipeline stages? - Knowledge Base

@mykhailo As you said we can get 500 error for GOAL_RESULT
As your pipeline exists but has no stages, can you add a stage there and try again?
We checked this with customer and that is not the case, can u check what can be other issue here

Hi @pm-fivetran

Sorry for the long reply. The team who is working on these Goals endpoint has already been notified about this case. I can’t give any ETA but I will do my best to keep this topic updated.