API to access Import results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlexH
    Junior Member
    • Aug 2023
    • 9

    API to access Import results

    Hello,

    I want to use the EspoCRM API to import data and access the import results.

    I have successfully set up Authentication by API key as described here: https://docs.espocrm.com/development...ion-by-api-key, and am able to get data from the API using Python.

    To get import data, I checked what URL was being used when viewing the import list/ results page in the EspoCRM user interface, and have tried the following
    Code:
    response = requests.get(
        "https://mydomain/api/v1/Import",
        headers={'X-Api-Key': os.environ.get('ESPOCRM_API_KEY')}
    )​
    This returns 200 status code, but an empty list of results. The status code, headers, and data returned are:
    Code:
    <Response [200]>
    {'Server': 'nginx', 'Date': 'Wed, 01 Nov 2023 16:27:17 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-App-Timestamp': '1698310564', 'Expires': '0', 'Last-Modified': 'Wed, 01 Nov 2023 16:27:17 GMT', 'Cache-Control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'Pragma': 'no-cache', 'Content-Encoding': 'gzip'}
    {'total': 0, 'list': []}


    Could you please let me know how I can use the EspoCRM API to get import data results?

    Thanks!
    Alex Howes
    Last edited by AlexH; 11-01-2023, 04:33 PM.
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    Hey,

    If there is no import result but the returned request will be empty, also i am not sure if this was designed to be accessed via API.
    Rabii
    Web Dev

    Comment

    • AlexH
      Junior Member
      • Aug 2023
      • 9

      #3
      Hello, there are import results as I have imported data in the UI.

      I see that endpoints for accessing import results are used in the UI. Do you know if these or other endpoints are available for accessing import results with API key authentication?

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        I have checked and it seems it is not accessible.
        Rabii
        Web Dev

        Comment

        • AlexH
          Junior Member
          • Aug 2023
          • 9

          #5
          Ok, thanks for checking

          Comment

          • AlexH
            Junior Member
            • Aug 2023
            • 9

            #6
            I see in the user interface that the import results are being posted/ get from API, but I guess this isn't accessible via API key authentication?

            Do you know if it is possible to make this possible with a customisation?

            Comment

            • yuri
              Member
              • Mar 2014
              • 8452

              #7
              Only own items non-admin users are allowed to see: https://github.com/espocrm/espocrm/b...datory.php#L50

              You can define a custom "mandatory" access filter and an access checker in metadata. Or just create a custom endpoint.
              If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

              Comment

              Working...