Postman Networking Objects

NetworkingRich
Here to help

Postman Networking Objects

This JSON

 

[
    {
        "name": "Test Object",
        "type": "ipv4Cidr",
        "value": "10.0.0.0/24",
        "networkObjectGroupIds": []
    },
    {
        "name": "Test Object 2",
        "type": "ipv4Cidr",
        "value": "10.1.1.1/24",
        "networkObjectGroupIds": []
    }
]
 
Keeps getting this error
 
{
    "errors": [
        "The following required parameters are missing: 'name', 'type' and 'value'"
    ]
}
 
 
I am using postman doing a post request to https://api.meraki.com/api/v0/organizations/{organization id}/networkObjects
(where organization id is the actual ID)
 
Any reason why I would be getting this error?

 

 

 

 

13 Replies 13
AutomationDude
Building a reputation

Prob a syntax error ... would be pretty hard to debug without running the actual code. I can't seem to spot what's wrong with what you've shared though

Inderdeep
Kind of a big deal
Kind of a big deal

Not sure but are you using API v0 ? Can you check with v1 

API v0

https://developer.cisco.com/meraki/api/#!versioning/v0-deprecation--sunset 

 

API v1

https://developer.cisco.com/meraki/api-v1/#!introduction/whats-new-in-v1 

Regards/Inder
Cisco IT Blogs awarded in 2020 & 2021
www.thenetworkdna.com
NetworkingRich
Here to help

I changed the API URL to 

https://api.meraki.com/api/v1/organizations/{organization  id}/networkObjects

 

That did not work. 

NetworkingRich
Here to help

I just ran across the V1.7 beta which network objects are in beta, and it had the base URL as

https://api-mp.meraki.com/api/v1

 

which still returned the same results. I can do a get request on all 3 of the Base URLs and gets the info from the Objects I created manually, but I need to create upwards of 2000+ and cannot see me getting available time to create each one individually on the GUI

PhilipDAth
Kind of a big deal
Kind of a big deal

When I have these kinds of issues I do a "get" request first, see the kind of data that has been returned, match it, and then use that when sending updates.

Greenberet
Head in the Cloud

I don't see an error on your test, but you should consider changing the api point.

I've just received an e-mail that they will change the api and this one will be removed in the future

 

See Documentation for the new api

NetworkingRich
Here to help

I am getting a 400 Bad Request. I did receive the email on the update from network objects to policy objects and am getting the same result. The get request information is different from what you need to send because it contains created times, object IDs, etc. What I am sending is the recommended by the meraki configuration guide that was released. 

GIdenJoe
Kind of a big deal
Kind of a big deal

I just got some e-mails today detailing that the old calls should still work but they created a new location for the now called "policy objects'.

 

It seems they are in fact going to implement service objects in addition to network objects which is just awesome.

Maybe try to get the new API calls and check if anything changed.

NetworkingRich
Here to help

Yup I tried all of that with the new syntax and I am still getting the same error. I tried to do a policy group and it gave me a similar error, but the get request worked on that. So obviously there is something that I am missing that needs to be added to a post request for these policy objects.

NetworkingRich
Here to help

Alright so I have a small update. I can add objects individually but not multiple in the json format

 If I send this it works

 

    {
        "name": "ps_api_test",
        "type": "ipv4Cidr",
    "category" : "network",
        "cidr": "10.1.1.1/24",
        "groupIds": []
    }
 
But If I try to add a second one say;

    {
        "name": "ps_api_test_2",
        "type": "ipv4Cidr",
    "category" : "network",
        "cidr": "10.2.2.1/24",
        "groupIds": []
    },
    {
        "name": "ps_api_test_3",
        "type": "ipv4Cidr",
    "category" : "network",
        "cidr": "10.3.3.1/24",
        "groupIds": []
    }
 
 
Then I get a JSON format error (to be expected), when I add the [] at the beginning and end I get the same error I was getting before. Any Ideas?

 

Greenberet
Head in the Cloud

oh right you can only add one at a time here.

 

If you want to add multiple entries, then you could try it with action batches 

GIdenJoe
Kind of a big deal
Kind of a big deal

It's strange, I can find the policy objects in dashboard under help API docs, but the interactive API docs doesn't have these endpoints yet.  These are handy because they contain examples and an import for Postman.

 

By the looks of the POST and PUT calls you can only add or modify one policy object at a time.

And for action batches, normally if the documentation would have been complete then you would have known if these calls can be put in an action batch.

 

For now, you'll need to script a series of these calls and just catch the error if you made too many calls and make it wait the time.

NetworkingRich
Here to help

Yes I scripted all the groups and objects in a python script that looped through an excel sheet. Works great. Thanks for the help everyone

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.
Labels