Search code examples
ioslinkedin-api

How to share a URL to linkedIn via iOS app


In a iOS app I need to share url to LinkedIn via iOS app and LinkedIn native app is not installed in the device.I need to share url without th LinkedIn app installed Please guide me how cabn I do the same


Solution

  • the different options are detailed under: https://developer.linkedin.com/docs/share-on-linkedin

    via opening SAFARI

    just call a customized URL with openURL:.

    the format of the url is described by the linkedIn Developer Docs:

    example:

    https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn
    

    via REST API

    e.g. call via NSURLSession

    https://api.linkedin.com/v1/people/~/shares?format=json
    

    and pass JSON body

    e.g.

    {
      "comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
      "visibility": {
        "code": "anyone"
      }
    }
    

    Note that with the REST API, you need to register your app with linkedin (all described in the docs)