I need to add companies to projects using the fieldapi/companies/v1/add_to_projects api. The problem is although I have these companies in admin (added via hq/v1/accounts/:account_id/companies), I don't have the necessary field company ids for them to make the add_to_projects call (the field project ids are no problem). Therefore, I'm trying to add each company to Bim360 Field Company using the fieldapi/companies/v1 api. I will then retrieve the id and make the add_to_projects call.
When I POST the following url from Java, I get this error: Illegal repetition near index 338. When I POST the identical url from Postman, it returns status 200 and a list of all Field projects.
What is going on here? I don't understand why it doesn't like this Json string when invoking it from Java. I'm using the Spring REST templates, which work beautifully when used to call a dozen other field and admin apis--passing json all over the place. Also, when I make the same call via Postman, it treats it like I'm calling GET /fieldapi/companies/v1. I've checked over and over again, and I'm definitely calling POST.
Also, I'd be curious to know what the bare minimum amount of data contained in the Json string is. I only need to pass the Company Name and have no idea what other fields are required or optional.
POST http://bim360field.autodesk.com/fieldapi/companies/v1?ticket=c7d2c403-326f-430b-be72-df03c3283b8c&co... MOUNTS LLC","ctype":"C - Constructions","category":"Contractor","description":"Engineer","duns_no":"Engineer","ein_no":"0","url":"www.microdesk.com","telephone":"212-354-5656","fax":"999-888-7766","address":{"address1":"PO BOX 5205","address2":" ","address3":" ","city":"NEW YORK","county":null,"state":"NY","country":"US","postal_code":"10008-5205"},"custom_fields": [{"name": "Trade","display_type": "text","value": "","default_value": null,"possible_values": []}]}
I'm sure you figured out this by now (I hope). So this is for those who tries to search.
As you rightly stated, you will need to use HQ API to add companies in account level. But id's in HQ and Field are different. So you will need to find a way to associate between two types of ids.
GET /fieldapi/companies/v1
https://bim360field.autodesk.com/apidoc/index.html#fieldapi/companies/v1/companies_api_method_1
without project_id returns list of all the companies. In the response value, you will see id (for Field id) and hq_identifier (which for HQ id).
Using this, you can map between two types of ids.
You can then add a company to a project using the following:
POST /fieldapi/companies/v1/add_to_projects
https://bim360field.autodesk.com/apidoc/index.html#fieldapi/companies/v1/companies_api_method_5
From the description, it seems to me that you are trying to add company at the account level, using the code at the bottom. Adding a company to the account level, you will need to use HQ API now.
https://developer.autodesk.com/en/docs/bim360/v1/reference/http/companies-POST/
It's a little confusing as we go through the transitions toward the unified BIM 360. But I hope this explains at least for those who might encounter the similar issues.
Can't find what you're looking for? Ask the community or share your knowledge.