Cover photo

A straight foward, practical guide to how to list your P00ls token on the Lens Protocol API.

Into to the Lens API system!

This practical guide is for those who wish to have their own P00ls creator's token to use across the Lens protocol to build, engage, and reward your community of fans who subscribe to your publications and collect your content. Here is a straightforward guide to the three-step process you need to do to have it listed across the whole Lens Dev garden via its API.

Key Lens reference links

- https://docs.lenses.io/2.0/dev/
- https://docs.api.lens.org/getting-started.html
- https://support.lens.org/knowledge-base

Step one:
Request access to the Lens API

To request access to the Lens API, follow these steps:

  1. Sign In: Ensure you are signed into your Lens account.

  2. Access the API Request Form: Navigate to the "API and Data" tab on the Lens platform. Click on the “Select This Plan” button, which will prompt a service request form to appear.

  3. Complete the Request Form: Fill out the API request form with detailed information about yourself, your organization, the intended use of the data, the duration of your project, and how you will comply with the Lens Terms of Use. Providing accurate information is crucial to expedite the approval process.

  4. Submit Your Request: After completing the form, submit your request. You will receive a confirmation email indicating that your request has been received.

  5. Await Approval: Your request will be reviewed manually. If approved, you will receive further instructions via email on how to generate API tokens. If not approved, you will be notified on how to improve your request or may be invited to discuss it with a member of the Lens business team.

  6. Check Status: You can monitor the status of your request in the "Your Active Access" tab of your account once submitted

Step Two
Create a Lens API access token

Request API Access: Sign into your Lens account and complete the API request form under the API and Data tab. Provide accurate information about your intended use.

  • Approval: Wait for your request to be reviewed. If approved, you will receive instructions via email.

  • Create Access Token: After approval, go to the "Your Active Access" tab in your user profile to generate your access token. You can create up to five tokens, each valid for one year
    Step three:

    List your token on the Lens API by following these steps:

    1. Access the Lens API: Ensure you have been granted access to the Lens API service. You can request access if you haven't done so already.

    2. Create an Access Token: Navigate to your user profile page on the Lens platform and create an access token. This token will be essential for authenticating your API requests.

    3. Use an API Client: You can utilize any API client such as Postman or cURL to make requests to the Lens API.

    4. Authentication: For all API requests, you need to include your access token in the request header. For example, use:

      text

      Authorization: Bearer your-access-token

    5. Making Requests: Depending on the type of request (GET or POST), format your API call accordingly. For example, to search for scholarly works, you would use:

      text

      POST https://api.lens.org/scholarly/search

    6. Rate Limiting: Be aware of the rate limits imposed by the API. Monitor the response headers to avoid exceeding the allowed number of requests

    By following these steps, you can efficiently list your token and interact with the Lens API.

    How can I authenticate my API request properly?

    To authenticate your API request for the Lens API properly, follow these guidelines:

    Authentication Method

    The Lens API uses token-based authentication. You must first obtain an access token after your API access request is approved. Here’s how to include the token in your requests:

    1. Obtain an Access Token: After your API access request is approved, create an access token from your user profile page in the Lens platform.

    2. Include the Token in Requests:

      • For POST requests, include the access token in the request header:

        text

        Authorization: Bearer your-access-token

    3. For GET requests, you can include the access token as a query parameter:

      text

      https://api.lens.org/scholarly/search?token=your-access-token

    Example of a POST Request

    Here’s an example of how to make a POST request with the access token:

    bash

    curl -X POST https://api.lens.org/patent/search \ -H "Authorization: Bearer your-access-token" \ -H "Content-Type: application/json" \ -d '{"query": "your_query_here"}'

    Important Notes

    • Ensure that your access token is kept secure and not exposed in public repositories or client-side code.

    • If your request fails with a 401 Unauthorized error, check that your token is valid and included correctly in the request.

    Following these steps will ensure that your API requests to the Lens API are properly authenticated

    What happens if my API request is denied?

  • If your API request to the Lens API is denied, you will typically receive a notification indicating the reason for the denial. Here are the common outcomes:

    1. Improvement Suggestions: You may receive guidance on how to improve your request. This could involve clarifying your intended use of the API or providing additional information about your organization or project.

    2. Discussion Opportunity: In some cases, you might be invited to discuss your request further with a member of the Lens business team. This can help clarify any misunderstandings and potentially lead to approval.

    3. No Access Granted: If your request does not meet the necessary criteria or guidelines, you will not be granted access, and the specifics of the denial will be communicated to you.

    You can check the status of your access request in the "Your Active Access" tab of your Lens account to see if there are any updates or further actions required on your part

    More useful info on the Lens API

    To access and manage your API collections in Lens, follow these steps:

    1. Accessing Collections:

      • You can access your scholarly works collections from your Work Area on the Lens platform. The specific collection can be accessed using its unique {collection_id}, which can be found in the URL of your collection page. For example:

        text

        https://www.lens.org/lens/scholar/search/results?collectionId={collection_id}

    2. API Endpoints for Collections:

      • To interact with your collections via the API, you can use the following endpoints:

        • Retrieve Collection:

          text

          [GET] https://api.lens.org/collections/{collection_id}

    3. Update Collection:

      text

      [POST] https://api.lens.org/collections/{collection_id}

    4. Authentication:

      • Ensure you have created an access token from your user profile page on Lens. This token is required for authenticating your API requests. Include it in your request headers:

        text

        Authorization: Bearer your-access-token

    5. Managing Access:

      • You can manage your access and tokens from your Lens user profile. This includes requesting access to the API and handling your access plans.

    6. Rate Limiting:

      • Be mindful of the rate limits imposed by the API to avoid exceeding the allowed number of requests. You will receive headers in the response indicating your remaining request limits.

    By following these steps, you can effectively access and manage your API collections in the Lens API environment.

    What are the different API endpoints available in the Lens API

  • The Lens API provides the following main endpoints:

    Patents:

    • [POST] https://api.lens.org/patent/search

    • [GET] https://api.lens.org/patent/search

    • [GET] https://api.lens.org/patent/{lens_id}

      Scholarly Works:

    • [POST] https://api.lens.org/scholarly/search

    • [GET] https://api.lens.org/scholarly/search

    • [GET] https://api.lens.org/scholarly/{lens_id

      Collections:

    • [POST] https://api.lens.org/collections/{collection_id}

    • [GET] https://api.lens.org/collections/{collection_id}

    To access your scholarly works collections, you can use the {collection_id} found at the end of your collection URL on the Lens platform. For example: https://www.lens.org/lens/scholar/search/results?collectionId={collection_id} The Lens API also provides endpoints to check your API usage:

    • [GET] https://api.lens.org/subscriptions/patent_api/usage

    • [GET] https://api.lens.org/subscriptions/scholarly_api/usage

    Swagger documentation is available at https://api.lens.org/swagger-ui.html to explore the API further.

Loading...
highlight
Collect this post to permanently own it.
Subscribe to Tavern Studios and never miss a post.
#cryptocurrency#blockchain#web3#art#music#film#defi#nft