pinterest / api-quickstart

Code that makes it easy to get started with the Pinterest API.
Apache License 2.0
119 stars 44 forks source link

user top pins in v5 is missing a lot of fields #89

Closed chrizi42 closed 1 year ago

chrizi42 commented 1 year ago

Hi!

We are attempting to migrate to v5 and noticed that the new endpoint for user top pins (/v5/user_account/analytics/top_pins) gives a vastly different response than the old one (/v3/partners/analytics/users/{user_id}/pins/top/). A LOT of pin fields are missing in v5.

We are in need of the following fields that used to be available in the v3/v4 endpoint: "title", "description", "image_large_url", "image_medium_url", "image_square_url", "tracked_link", "link"

How do we get these missing fields in v5 for users top pins?

V5 endpoint: https://api.pinterest.com/v5/user_account/analytics/top_pins Docs: https://developers.pinterest.com/docs/api/v5/#operation/user_account/analytics/top_pins

V3/V4 endpoint https://api.pinterest.com/v3/partners/analytics/users/{user_id}/pins/top/ Docs (broken link but this was the docs) : https://developers.pinterest.com/docs/redoc/adsreporting_ads_v4/#operation/v3_analytics_partner_top_pins_GET

davidchaiken commented 1 year ago

Thanks for the question! The API product team is thinking about the best way to respond. In the meantime, I'm wondering whether it would be possible to use the list or get pins endpoints to retrieve the information that your app needs?

chrizi42 commented 1 year ago

Hi!

Thank you for the quick response <3 We have now tried using the list endpoint in combination with user top pins and we get all the fields we need except "tracked_link" which is currently missing from all pin endpoints. Is there any chance of adding "tracked_link" to the list pins response?

davidchaiken commented 1 year ago

Sorry that I didn't answer the part of your question about tracking links! Our thinking (assuming that we understand your use case) is that you can get this information by using the List/ads or Get/ad endpoints. Would that work for you?

davidchaiken commented 1 year ago

Hello @chrizi42 ! I hope that the suggested endpoints work for you. Please reopen this issue if not.

chrizi42 commented 1 year ago

@davidchaiken Hi, combining with list ads to get the missing metrics works. But we ran into another issue. The new top pins endpoint is returning both organic and paid ads/pins and we are unable to differentiate between them. Is this by design? We would like to get only the organic ads/pins, as we were able to do before in v3/v4.

davidchaiken commented 1 year ago

Thanks for the feedback! I'll ask the team.

davidchaiken commented 1 year ago

Hi, @chrizi42. Thanks again for pointing out the issue that you're having with the v5 top pins endpoint. The team here is really enthusiastic about responding to developer feedback! They agree that we should continue to support the parameters that give you the option to separate organic and ads content. They plan to review endpoints that are similar to top pins, figure out the best way to implement the functionality in v5, and schedule the engineering work. I'll keep an eye on this work and try to remember to let you know when the top pins endpoint has the parameter that you need.

chrizi42 commented 1 year ago

Thank you for looking into this! The current workaround we are using is the following:

First we call user_account/analytics/top_pins for the top 50 pins per day. We then iterate over a set of those pin_ids and call pins/{pin_id}/analytics for each. Some calls return 404 "pin not found". We assume this is due to some pins, that are returned from top_pins, are actually ads, and that the endpoint therefore doesn't return organic data for those. For the pin_id(s) that we receive organic data for, we iteratively call pins/{pin_id} to get the metadata for the pins.

davidchaiken commented 1 year ago

That sounds like a creative workaround. 🤔 I'll keep an eye on the work that we need to do to get you a better solution.

davidchaiken commented 1 year ago

Hi, @chrizi42.

On Friday (June 9), we deployed an update to our API that adds a content_type parameter to the top_pins and top_video_pins endpoints. These three settings should work: content_type=ALL, content_type=ORGANIC and content_type=PAID. If this change works for you, we can close this issue.

chrizi42 commented 1 year ago

Awesome! :heart_eyes: We will try it out and get back to you.

davidchaiken commented 1 year ago

The update documentation is now available on this API documentation page.

AxelFunnel commented 1 year ago

Hi @davidchaiken!

Thank you so much for updating the API with the conent_type parameter. We have tried it out and it looks good!

However, our issue remains when fetching pin meta data for specific pins. When calling the Get Pin endpoint with an organic pin_id returned from the Top Pins endpoint, we often get an 404 error with code 50 and message "Pin not found". Do you have any idea why this is happening? We experience the same issue with the List Pins endpoint.

Again, thank you so much for your help. It is highly valuable for our work.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. Off the top of my head... I'm wondering whether the OAuth token that you're using has ads:read scope? Also, are you providing the appropriate ad_account_id parameter to Get Pin?

AxelFunnel commented 1 year ago

Hi again and thank for for your answer! My bad, I might have been bit unclear in my previous message. This issue is persistent per ad_accounts. In other words, out of all pins returned from the Top Pins endpoint for an ad_account, some pins receive 404 error when querying the Get Pin endpoint using the ad_account_id and pin_id as parameters.

davidchaiken commented 1 year ago

I tried to reproduce this issue with test accounts, but didn't see any problems.

A good next step would be to get the information from you that's required for me or someone else at Pinterest to reproduce the problem with your account. The best way to send us the relevant information (account number and pin_id) is to request for help at https://help.pinterest.com/en/contact. Click on Pinterest API and Developer Tools. Then click on API Technical Support. Then click on Pinterest API v5. Then, enter the information about this problem. Please mention my name in the Description of the issue so that our support team can loop me into the conversation if necessary.

In the meantime, I'm going to close this issue, because we've gone past the scope of the original issue (top_pins missing fields and parameters).

davidchaiken commented 1 year ago

Hi, @AxelFunnel. How's it going with the 404 errors? I'm asking because I'd be happy to try to reproduce the issue using the data in your account, but it's best not to exchange the relevant information (account id, pin ids) in an issues thread on GitHub.

AxelFunnel commented 1 year ago

Hi again @davidchaiken! Hope you are well! We are still investigating this issue and have created a ticket at Pinterest Technical Support, but we are not able to see any ticket details. It's sent from the same email as our previously closed ticket #12554572, so hopefully this can help you find it. Let me know if not, and we'll do our best to describe the situation here.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. Yes, I'm good. :) Thanks for asking! I hope you're also doing well, despite the 404 issues.

I checked with our support team. They said that they sent an answer on June 16 but didn't hear back from you.

In any case, they sent me the pin and account information from the support ticket. (Thanks for sending this information outside of GitHub by the way. That's much more secure than this public channel.) I will try to reproduce the 404 issue and provide information about anything that I find to both our support and our development teams.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. Here are a couple of things that I've discovered so far:

  1. Our API may be returning 404 Not Found instead of 401 Unauthorized, which may be a bit confusing.
  2. There are some interesting issues associated with the pin and account information that you sent in your support ticket.

I'm working with our support team to reach out to you so that I can send more specific information to you.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. Our support team says that they reached out to you with some information that I sent to them. Please let me know if it makes sense. If not, I'll try to get access to our support system so that I can communicate with you more directly.

AxelFunnel commented 1 year ago

Hi David! Thanks for getting back to us. We just received feedback from the support in another ticket (Title: Follow-up on ticket #12554572), and our issue seems to be related to pin ownership for GET_PINS. The TOP_PINS endpoint returns all top pins, no matter who has ownership of the pin. This is great and expected, as it matches what we see in the Pinterest UI (both claimed and owned pins). However, when fetching data for those pin_ids through the GET_PINS endpoint, we get an 404 error for the claimed pins that are not owned by the user. This means that we are not able to get Pin metadata, such as "Pin Title", "Media", etc for a large number of the pins returned from the TOP_PINS endpoint. Without metadata, our users are not able to identify their pins, so we would really appreciate a solution for this.

For context, here is the answer from the support team:

I confirm that we don't have the domain ownership check at this moment via GET Pin endpoint - only direct Pin ownership. However, I've shared your use case internally for consideration, I'll let you know once I hear back from the team.

Let me know if you have any questions or if anything else comes up in the meantime.

Thanks, Thalyta da Matta - Customer Ops

Best, Axel

davidchaiken commented 1 year ago

Thanks for the update, @AxelFunnel. I was the one who did the investigation that let to this conclusion. I'm glad that you understand the issue! Now, we can work together to figure out the right solution. We can continue the discussion here or on the support ticket, whatever you prefer.

We (the development and support teams, together) would like to understand more about your use case. Here's a question that might help us understand what you're trying to accomplish... Why is it that the top pins on the account using the TOP_PINS endpoint are owned by different users? For example, are the pin owners different employees working for the same company? If we understand more about how this can happen, we might be able to figure out how to design a solution to this issue.

If you're comfortable answering this question in this public thread, that's great because it's visible to anyone in the community. But if you'd prefer to share more confidentially, please reply to the email from Thalyta. I'll be able to see your response on the support ticket and we can continue the conversation there.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. I spent some more time understanding how the top_pins endpoint works and think that I have a much better understanding of how it's supposed to work -- and why the v5 version isn't working for you. I need to work with a few different teams at Pinterest to make sure that everyone understands the problem, and then will get back to you. Thanks for your patience and feedback!

AxelFunnel commented 1 year ago

Hi @davidchaiken! Great! That sounds very promising. Don't hesitate to get back to me if you need any assistance or have more questions.

Again, huge thanks for your help and assistance in this matter.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. The development team now understands the issue: the top_pins endpoint retrieves pins that are linked to each partner's claimed domain whether or not the partner owns the pins; and partners need a way to get detailed information about these pins. They are starting to work on a solution to this issue.

davidchaiken commented 1 year ago

Hi, @AxelFunnel. Good news! We think that we solved the problem with the 404 errors that you've been getting on pin ids retrieved through top_pins. Essentially we made it possible for partners with a claimed domain to GET pins that link to their domain. This change was deployed today. I'd appreciate it if you would check to see if we have resolved the 404 issue for you.

AxelFunnel commented 1 year ago

Amazing!! That sounds very promising. We will try it out as soon as we're able and get back to you!

AxelFunnel commented 1 year ago

Hi again @davidchaiken. We have done some testing and everything seems to be working as expected! We can now fetch all pins from GET_PINS that we receive in TOP_PINS. We are very grateful and really appreciate your help and dedication in this matter.

Feel free to close this issue now. Have a great summer!

davidchaiken commented 1 year ago

Thanks, @AxelFunnel! I appreciate your patience and feedback.