问题
When try to update status with link in linkedin api i'm getting this error frequently.
Example Link: http://www.world-grain.com/articles/news_home/World_Grain_News/2016/06/General_Mills_files_patent_on.aspx?ID={30B4213B-4E10-4AF6-9B56-0D5614D7AFD3}&cck=1
If i remove the { and } from the link it get posted. Even in linkedin site itself its not working.
Help me if anyone know the reason.
回答1:
I was receiving the same error and the reason was that I didn't send values for all the keys in request's body. For example: "content" parameter in linkedin's request body is a dictionary with 4 keys:
- title
- description
- submitted-url
- submitted-image-url
I had no image url so I didn't set the key "submitted-image-url" at all. The solution was to set the value to empty string "".
I wonder why linkedin can't parse dictionary if it doesn't have all the keys but that's the way it works.
Hope this helps
回答2:
You may need to URL encode the braces in your link:
http://www.world-grain.com/articles/news_home/World_Grain_News/2016/06/General_Mills_files_patent_on.aspx?ID%3D%7B30B4213B-4E10-4AF6-9B56-0D5614D7AFD3%7D&cck=1
I ran into the same error when I attempted to pass a URL with spaces. It published successfully after URL encoding the spaces (%20
).
来源:https://stackoverflow.com/questions/37806237/getting-s-412-precondition-failed-invalid-arguments-error-in-linkedin-share-api