cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

Re: REST API for adding/removing child data sources?

I've added "childType": 2 to the JSON, now I'm getting "ERROR_CannotAddAgent (758)". Tried adding more parameters until the body looked like your example, one at a time, finally got this:

 

{"datasource": {"parentId": "144121785330171904", "name": "API Test2", "id": "", "typeId": 130, "childEnabled": false, "childCount": 0, "childType": 2, "ipAddress": "1.2.3.6", "zoneId": 0, "idmId": "", "url": "", "enabled": false, "parameters": [{"key": "autolearn", "value": "count"}]}}

 

Got the same error. Tried to remove parameters, no change. The user has Admin rights and can add parents, the parent ID I got from

 

"typeName": "Juniper Secure Access/MAG",
"parsing": true,
"inSync": false,
"elmLogging": "no",
"typeId": 130,
"id": "144121785330171904",
"name": "Bremote1"

 

What am  I doing wrong?

McAfee Employee
McAfee Employee
Report Inappropriate Content
Message 12 of 14

Re: REST API for adding/removing child data sources?

I'm curious if it may be a bug. My testing was done under the NGCP account credentials. Can you test the same code with the different permission set and see if it alters the results.

I am not seeing anything stand out that would cause issues. My testing has been done in 11.1.2, and I am submitting my query to the v2 API (https://esm.ip/rs/esm/v2/dsAddDataSource)

Highlighted

Re: REST API for adding/removing child data sources?

Progress!

 

I'm using API v2 as well, but on ESM v. 10.3.4. I tried with the NGCP credentials, got the same error. Tried with a minimal JSON:

{"datasource": {"parentId": "144121785330171904", "name": "API Test2", "typeId": 130, "childType": 2, "ipAddress": "1.2.3.6", "enabled": false}}

 

No joy. But then I thought to try a different parent:

"typeName": "Juniper Secure Access/MAG",
"parsing": false,
"inSync": false,
"elmLogging": "no",
"typeId": 130,
"id": "144121785313394688",
"name": "Bremote2-old"

 

That's a twin of the original parent that had been disabled a long time ago. Well, the same API call worked! It now has a child called "API Test2". Tried again, with a different name and IP, and a 2nd child was added. I tried with my own credentials on a childless data source and it worked as well. Then I tried to add a child to a 4th data source, one that, like the original one, already had a child, and again got the "ERROR_CannotAddAgent (758)".

 

So I can add childs, but only if the DS is childless.

 

Highlighted
Reliable Contributor
Reliable Contributor
Report Inappropriate Content
Message 14 of 14

Re: REST API for adding/removing child data sources?

You can add multiple datasources (agents/clients) at the same time with dsAddDataSourceList

Brent
You Deserve an Award
Don't forget, when your helpful posts earn a kudos or get accepted as a solution you can unlock perks and badges. Those aren't the only badges, either. How many can you collect? Click here to learn more.

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community