powershell API for sc_task table

Justin Dietz
Tera Contributor

I'm trying to use powershell and the SNOW API to GET tasks from sc_task table.   


For reference I can pull back RITM w/ no issue from sc_req_item table.   To do this i am using the following as example. 

$table = 'sc_req_item'
$value = 'RITM0253310'
$property = 'task_effective_number'
$uri = "https://xxxxxxxxxx.service-now.com/api/now/table/$($table)?sysparm_query=$property=$value"
 
This works w/ NO issues. 
 
but when i try similar on sc_task i get no reply.   here is that code.
$table = 'sc_task'
$value = 'TASK0627719'
$property = 'number'
$uri = "https://xxxxxxxxxx.service-now.com/api/now/table/$($table)?sysparm_query=$property=$value"
 
What am i missing here?  
And if i just use URI 
I start getting every RITM....but similarly if I try 
I get nothing!   
 
Using the user interface i have access to all of this.  I am not a SNOW admin but could this be a permissions issue?  I find it odd i can GET RITM but not Tasks.
 
 
 
2 REPLIES 2

KB18
Tera Guru
Tera Guru

Dear @Justin Dietz 

While using API to create SC task, you have to send parent value means RITM value so that it will get attached to RITM.

 

 

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas

I am trying to GET not create.  But regardless i feel like maybe i need to include the RITM somehow in the URL to get the Task?  

 

Can you give me an example of what the URL would look like whether it be to get data or create new?