问题
What's the right format for dateRange for rest-li
v2?
The current examples in the documentation do not support it, and I don't understand from the rest-li
documentation what's the format for it, exactly.
This is the request I make:
Headers:
X-Restli-Protocol-Version: 2.0.0
Authorization: Bearer <token-here>
URL (with request parameters):
https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=CAMPAIGN&dateRange.start.day=1&dateRange.start.month=1&dateRange.start.year=2017&timeGranularity=DAILY
OR
URL - deconstructed (with request parameters):
- Base URL:
https://api.linkedin.com/v2
Params:
q:analytics
pivot:CAMPAIGN
dateRange.start.day:1
dateRange.start.month:1
dateRange.start.year:2017
timeGranularity:DAILY
Error I get:
{ "serviceErrorCode": 100, "message": "Unpermitted fields present in PARAMETER: Data Processing >Exception while processing fields [/dateRange.start.day, /dateRange.start.month, >/dateRange.start.year]", "status": 403 }
Note: I'm referred to a question with the same error in the comments, however this might be caused by a different reason, and the answer there does not work for me. If by StackOverflow's standards you still think that it's a duplicate, please let me know and I'll close this question.
回答1:
Solution provided by one of the LinkedIn developers:
For Restli, version 2, for parameter dateRange
(tested only for endpoint AnalyticsV2
):
rangeDate := (start[,end])
(end
is optional)start
,end
- type:Date
Date := (day, month, year)
day
- type:integer
(tested for single digit only)month
- type:integer
(tested for single digit only)year
- type:integer
(tested for 4 digits only)
Final structure (not including the optional end
):
dateRange=(start:(day:,month:,year:))
Example:
dateRange=(start:1,month:1,year:2017)
回答2:
The first solution didn't work for me. As Linkedin's API documentation is shit in regards to this it took me a lot of trial and error. @Gal-Grünfeld final structure is correct but the example isn't. Linkedin's docs say the key is dateRange.start
which is wrong.
dateRange=(start:(day:1,month:9,year:2020))
来源:https://stackoverflow.com/questions/60436604/linkedin-ads-api-whats-the-format-of-the-daterange-request-parameter