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.

API is not working in POSTMAN

Devansh1
Tera Contributor

Hi all, 

we are trying to hi the api for our third-party website we have created record in Application Registry and a integration user with required roles, now the problem is when we are hitting tha api it is generating an error. 

(attached SS).

And the main thing is when we are trying to do with our another instance it is working fine. 

we have almost tried everything, what could be problem ......

 

Devansh1_0-1763111870411.png

 

3 REPLIES 3

GlideFather
Tera Patron

Hi @Devansh1

 

have you set the authorisation/access for your postman? 

_____
This reply is 100 % GlideFather and 0 % AI

Mexiprince
Kilo Sage
Kilo Sage

@Devansh1 . 401 error is unauthorized. So the API integration user/service account do they have the right role and permission to perform the action at the resources? Also did you select that in the authorization? Because if its working in another instance is it the same credentials or different?

 

Its access issues 

MaxMixali
Kilo Sage

Guardando l'errore sembra un problema di policy di accesso, dovresti fornire maggiori dettagli ma potresti fare questi controlli. 

Molto dipende dal tipo di autenticazione che stai cercando di usare 

 

STEP 1: Verifica Application Registry
Vai su: System OAuth > Application Registry
Trova la tua applicazione e verifica:
Campi da controllare:

Active = deve essere checked (✓)
Client ID = deve essere identico all'altra istanza
Client Secret = rigeneralo se necessario e aggiornalo nel sistema di terze parti
Token URL = deve puntare all'istanza corretta
Default Grant Type = verifica che sia lo stesso dell'istanza funzionante
Access Token Lifespan = controlla il valore (default: 1800 secondi)
Refresh Token Lifespan = controlla il valore

Confronta TUTTI questi valori con l'istanza funzionante

STEP 2: Verifica Integration User
Vai su: User Administration > Users
Cerca il tuo integration user e verifica:
Campi critici:

Active = deve essere checked (✓)
Locked out = deve essere VUOTO (non locked)
Password needs reset = deve essere VUOTO
Web service access only = dovrebbe essere checked (✓)
Internal integration user = dovrebbe essere checked (✓)

Verifica i Ruoli:

Apri il record dell'utente
Vai alla Related List: Roles
Confronta i ruoli con quelli dell'integration user nell'istanza funzionante
Ruoli comuni necessari:

rest_service
soap_query
web_service_admin (se necessario)
Altri ruoli specifici per le tabelle che devi accedere

 


STEP 3: Verifica System Properties
Vai su: System Properties > System Properties
Cerca e verifica queste proprietà (usa il filtro Name):
Property NameValore Richiestoglide.oauth.enabledtrueglide.rest.enabledtrueglide.rest.cors.enabledtrue (se necessario)glide.outbound_http.enabledtrue
Come verificare:

Cerca ogni property per Name
Controlla il campo Value
Se il valore è "false", cambialo in "true"
Salva


STEP 4: Verifica Plugin Attivi
Vai su: System Plugins > Plugins
Cerca e verifica che questi plugin siano attivi:
Plugin necessari:

OAuth 2.0 (com.glide.oauth)

Cerca: "oauth"
Verifica che Active = Yes


Integration - Multiple Provider Single Sign-On Installer (se usi SSO)

Cerca: "integration"
Verifica stato

 

Come verificare:

Usa il filtro "Name contains" = "oauth"
Controlla la colonna Active
Se non è attivo, clicca sul plugin e attivalo (ma richiede riavvio istanza)


STEP 5: Controlla ACL (Access Control Lists)
Vai su: System Security > Access Control (ACL)
Verifica che l'integration user possa accedere alle risorse necessarie:

Filtra per Table = la tabella che la tua API deve accedere
Cerca ACL per operazioni: read, write, create, delete
Verifica che il ruolo dell'integration user sia incluso

Test rapido:

Vai su System Diagnostics > Debug Security
Seleziona la tabella target
Seleziona operation (es: read)
Clicca "Impersonate user" e seleziona il tuo integration user
Clicca "Debug" - ti mostrerà se l'accesso è consentito o negato


STEP 6: Verifica Certificati SSL
Vai su: System OAuth > Certificates
Verifica i certificati:
Controlla:

Ci sono certificati installati?
Sono scaduti? (controlla Valid From e Valid To)
Sono gli stessi dell'istanza funzionante?

Se i certificati sono scaduti o mancanti:

Importa nuovi certificati
Associali all'Application Registry


STEP 7: Controlla System Logs
Vai su: System Logs > System Log > All
Cerca errori durante la chiamata API:

Filtra per:

User = il tuo integration user
Created = oggi o nelle ultime ore


Cerca messaggi contenenti:

"unauthorized"
"forbidden"
"authentication"
"oauth"
"error"


Leggi i messaggi di errore - spesso indicano esattamente il problema


STEP 8: Verifica IP Access Control
Vai su: System OAuth > Application Registry
Apri la tua applicazione e controlla:

Vai alla Related List: OAuth Entity Scopes o Access Control
Verifica se ci sono restrizioni IP
Se ci sono IP whitelisting, assicurati che l'IP del sistema di terze parti sia incluso


STEP 9: Test Manuale dell'API
Vai su: System Web Services > REST Message