The CreatorCon Call for Content is officially open! Get started here.

Query regarding REST API using POST to create customer account

ankitbhatna
Tera Contributor

Hello,

 

I am exploring various REST APIs available for Customer Accounts in CSM module in Zurich release. However, I found that inbuilt 'Account API' provides GET methods to fetch customer accounts data but does not support POST method. 

 

Is there any inbuilt or third party plugin based api (like sn_tmf_api for Quote Management) available having POST method to enable customer account creation through REST API call.

 

I do not prefer to use Table APIs for this as it has the limitation of working on only a specific table.

 

Thanks, 

Ankit

4 REPLIES 4

KrishnaMohan
Giga Sage

Hi @ankitbhatna ,

There is no single out-of-the-box REST API in ServiceNow's CSM module that provides a POST method specifically for creating B2B Customer Accounts, as the (customer_account) Account API is primarily for GET requests.

I would recommend use Scripted REST API. This is the most common and flexible method for creating a custom endpoint that meets your specific needs. It's the standard ServiceNow best practice for creating custom APIs.
So that you have full control over the API. You can define the request payload, perform server-side validation, and handle complex business logic (e.g., setting default values, running business rules, or creating related records like contacts or accounts). This method also ensures that your API is versioned and documented within the instance.

 

If this helped to answer your query, please mark it helpful & accept the solution.
Thanks!
Krishnamohan

Ankur Bawiskar
Tera Patron
Tera Patron

@ankitbhatna 

your understanding is correct.

the Account API only has GET and doesn't have POST.

You can develop a scripted rest api as per your customer's need which gives you full control over the incoming JSON request body and then gives you control on the output i.e. JSON request body

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@ankitbhatna 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

kaushal_snow
Mega Sage

Hi @ankitbhatna ,

 

I checked the Zurich release and the CSM Account API only supports GET for customer accounts; there is no built in POST method for creating new accounts...

 

If you want account creation via REST in a controlled manner, here are two good options:

 

1. Scripted REST API, build your own API endpoint that accepts POST, validates the incoming JSON, populates the customer_account record, associates any related records, etc....

2. Table API, use the generic table API on customer_account (or relevant table), with proper ACLs and validation.....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/