Reply

How to handle record duplication in multiple objects request

vegachow
Not applicable
Posts: 0
696     0

I'm calling /wapi/v2.7.3/request with such kind of body to improve efficiency

[
{ "method": "POST", "object": "record:a", "data":{"name":"test1.pft.com", "ipv4addr":"9.0.0.1", "view":"internal"}},
{ "method": "POST", "object": "record:a", "data":{"name":"test2.pft.com", "ipv4addr":"9.0.0.1", "view":"internal"}},
{ "method": "POST", "object": "record:a", "data":{"name":"test3.pft.com", "ipv4addr":"9.0.0.1", "view":"internal"}}
]

 but I met a problem, one of the record is already there, so the whole request failed with error.

My requirement is :

if there is no record there, create one; otherwise, update the record to the new value

similar to the "upsert" logic in database.

 

Is there a way to implement it in one multiple objects request?

Any suggestion?

Highlighted

Re: How to handle record duplication in multiple objects request

Adviser
Posts: 101
696     0

Hi,

 

The request object is used as a single point of entry to make multiple calls. It is not meant for the purpose of implementing a conditional logic.

 

You can try doing a CSV import instead. For more information, refer to the "Import a CSV file" section in the WAPI reference guide here

 

Here is a sample CSV format you can use.

header-arecord,fqdn*,address*,view
ARecord,test1.demo.com	,10.0.0.100,internal
ARecord,test2.demo.com	,10.10.10.101,internal

Hope this helps,

Krishna

Showing results for 
Search instead for 
Do you mean 

Recommended for You