Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Problem Regarding Rest API Integration

yashz
Tera Contributor

Hello Community,

I am currently doing an assignement on REST APIs and my have a assignment problem is that,

Here is what my API should do

Whenever I create a record say in a table then a record should automatically get created into an another table and vice versa

also if I update a particular record in a table then the corresponding record which was created should also get updated.

3 REPLIES 3

Shane J
Tera Guru

In both cases, you're referring to a related record being updated when your API updates a record.

If that is correct, you need to either use Business Rules or Flow (via Flow Designer) to make updates (probably conditionally) to the related records.

yashz
Tera Contributor

Actually I need to do it using an Rest API not a business rule or a Flow Designer

BellBoy
Kilo Contributor

Your assignment involves implementing synchronization between two tables such that changes in one table are mirrored in the other. This requires:

Creating corresponding records when a record is added to one table.
Updating corresponding records when a record in one table is updated.

Implementation Steps
1. Set Up Two Tables
Assume you have two tables:

Table A
Table B
Both tables should have similar structures, with a unique identifier to link corresponding records.

2. Create an API Endpoint
Create a REST API with the following operations:

Create Record: Add a record to one table and automatically create a corresponding record in the other table.
Update Record: Update a record in one table and automatically update the corresponding record in the other table.