Rest API - adding users/contacts to the sys_user table

kydomingo
Tera Contributor

Hello and Good Morning,

 

just inquiring what is/are the best practice in terms if integration (with external sources ) with the sys_user table. We are planning to use REST API to add/update users in the sys_user table however, is this the best practice? Are there any suggested best practice, e.g., creating a temporary staging/import table and then using REST API to add users to a this staging table, then use an import/transform map.

 

thank you very much.

 

best regards,

ken

7 REPLIES 7

Kieran Anson
Kilo Patron

Hi Ken,

Import Sets (and in turn the import set rest api) are always going to be better than using the Table API. For me, the Table API is fine for querying data, but anything else and you start to lose data governance and control with how people are doing things.

 

Using the Import Set API, you can also pass multiple records which can save on the number of API calls if the third party system supports batching

Hello and thank you very much Sir.

 

Would this then be a recommended solution where we would need to regularly add/update core teables (e.g., sys_user table):

   1. Create a Data Source where type is "file" (csv/excel)

   2. Create the Import Set

   3. Update/upload new/updated version of the file using REST API

 

is #3 possible? is this direct to servicenow instance using REST API or should this be done via the Mid Server?

and/or would there be a better recommendation as per mentioned where we interact directly with the staging (import set) table via the import set API.  Apologies, as I am relatively new.. how would this work? does this mean we can use the import set rest api to update the import set table where it can be scheduled to update the core table (sys_user)?  

 

Thank you very much.

 

Best regards,

ken

Hello Kieran,

 

please kindly ignore the last reply.  Was able to perform/test the following:

1. Create Import Set Table (Staging Table) - via System Import Sets -> Data Sources
2. Create the Transform Map - via System Import Sets -> Transform Maps
      - create new Field Mappings
      - create a Coalesce field
3. Configure to allow multiple inserts - via System Web Services -> Insert Multiple
      - create a new record - where source table is the (Import Set) staging table created in #1
      - Set to either Synchronouse/Asynchronous
      - create a mapping entry where Type: JSON and Column mapping is Column Name (instead of Label)
4. Test PS script to add/insert records to the staging table created in #1.

 

Question though, noticed that the insert automatically adds/updates the records in the target table (e.g., sys_user), can this be configured such that once the record is created in the (Import Set) staging table, it would then follow the schedule of the transform map (if one was created)?

 

Thank you.

 

Best regards,

ken

Glad you got it working Ken, to confirm, are you wanting to stage records and not transform them until a specific point? So an almost queue like system that only processes say every Monday and do all created records since the last run?