GET /app/me/company

Company information can be retrieved from this endpoint using the default EDG header

Body:

*No body is required for GET requests

Response JSON Body:

[
	{
		"companyId": *Company ID,
		"companyName": *Company Name
	}
]

Code Example

Python example to fetch company information.

#!/usr/bin/python3

# Get_Company_Info.py
#
# Retrieve company ID from EDG API
# Company ID is required for several device/data operations
# This example is built on top of the API Login Example
#
# Copyright (c) 2021-2023 Engineering Design Group, LLC. All Rights Reserved.
#
# <variable_name> represents value specific to user

import requests
import json

#Need an access token to access this API endpoint
import Get_app_token

#returns company Name and company ID
def getCompanyId(accessToken = ""):

    if accessToken == "":
        accessToken = Get_app_token.getToken(<client_username>, <client_password>, <client_id>)

    #generate URL for POST request
    baseUrl = <API_URL>
    endpointAddress = "/app/user"
    CompanyIdUrl = baseUrl + endpointAddress

    #create header to send to API
    authHeader={
        "Authorization": "Bearer " + accessToken,
        "Content-Type": "application/json"
         }

    #retrieve company name and ID through GET request
    response = requests.get(CompanyIdUrl,
                            headers = authHeader,
                            verify = True)

    #display API response code
    print("Company ID: ", response)

    #extract company ID and Name from HTTP response
    CompanyList = response.json()
    CompanyName = CompanyList['companyName']
    CompanyID = CompanyList['companyId']

    return CompanyName, CompanyID

def main():
    print("Retrieving company name and ID...")
    company_name, company_ID = getCompanyId()
    #display company name and ID
    print("Company Name: ", company_name)
    print("Company ID: ", company_ID)

if __name__ == "__main__":
    main()