web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Business Central forum

How to fetch attachments of employee using business central REST API

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm trying to use Business Central API to fetch attachments of an employee (and other entities). The get attachment API needs a parentId in order to get the relevant attachments. however, I can't trace any parent id in the employee API. I tried to use the employee ID as the parentId without a success. I got an error response saying the resource can't be located. Do you know what I'm doing wrong?

Categories:
I have the same question (0)
  • Suggested answer
    Mohamad Vajid Profile Picture
    on at
    RE: How to fetch attachments of employee using business central REST API

    Hi,

    You can get the parentId by accessing https://api.businesscentral.dynamics.com/v1.0/api/v1.0/companies({id})/employees

    You will get something like this:

            "@odata.etag": "W/\"JzQ0O1BKaXRoT1Ruayt0bVRzMktxaGxMc0ZuNlE2SnJJdXBWblN6Y0JOdDArd1k9MTswMDsn\"",

               "id": "7bdba2c4-c65f-45ab-bd0b-4d866407469c",

               "number": "PS",

               "displayName": "Peter Saddow",

               "givenName": "Peter",

               "middleName": "",

               "surname": "Saddow",

               "jobTitle": "Sales Manager",

               "phoneNumber": "0678-9012-3456",

               "mobilePhone": "1234-5678-9012",

               "email": "",

               "personalEmail": "ps@cronus-demosite.com",

               "employmentDate": "2001-01-01",

               "terminationDate": "0001-01-01",

               "status": "Active",

               "birthDate": "1969-02-12",

               "statisticsGroupCode": "",

               "lastModifiedDateTime": "0001-01-01T00:00:00Z",

               "address": {

                   "street": "47 Main Street",

                   "city": "London",

                   "state": "",

                   "countryLetterCode": "",

                   "postalCode": "W1 3AL"

    The highlighted id in the above response is your parentId.

    Thanks,
    Mohamad Vajid

  • Community Member Profile Picture
    on at
    RE: How to fetch attachments of employee using business central REST API

    But then when I use api.businesscentral.dynamics.com/v1.0{tenant}/api/v1.0/companies({id})/attachments$filter=parentId eq '{empolyeeId}' I get an error response saying "No HTTP resource was found that matches the request URI"

  • Community Member Profile Picture
    on at
    RE: How to fetch attachments of employee using business central REST API

    But then when I use the following request api.businesscentral.dynamics.com/v1.0{tenant}/api/v1.0/companies({company})/attachments$filter=parentId eq '{employeeId}', I get "No HTTP resource was found that matches the request URI"

  • Community Member Profile Picture
    on at
    RE: How to fetch attachments of employee using business central REST API

    But then It fails on api.businesscentral.dynamics.com/v1.0{tenant}/api/v1.0/companies({companyId})/attachments$filter=parentId eq '{employeeId}' I get "No HTTP resource was found that matches the request URI"

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans