Jump to content

refresh item with powershell


paddy75

Recommended Posts

paddy75

hi all,

this are my first steps to use the api.
My goal is to read the title from a nfo file, search the itemid with the api and refresh this item. To read the nfo is not the problem, my problem is how to call the api.

For testing i have the following code
 

$apikey = 'your-key'
$stringTitle = 'your-title'

$mu = 'http://emby-url:8096/users/youruser-id/items?NameStartsWith=' + $stringTitle + '&Recursive=true&api_key=' + $apikey

$EmbyID = Invoke-WebRequest -Method Get -Uri $mu -ContentType 'application/json'
$FormatEmbyID = $EmbyID.Content | ConvertFrom-Json
$IDOutput = $FormatEmbyID.Items.Id
Write-Host '---------------------------------'
Write-Host "Updating title: $stringTitle"
Write-Host "EmbyID is: $IDOutput"
Write-Host '---------------------------------'
	
$mu1 = 'http://emby-url:8096/Emby/Items/' + $IDOutput + '/Refresh?MetadataRefreshMode=Default&api_key=' + $apikey
Invoke-WebRequest -Method Post -Uri $mu1

It gives me back the correct itemid
Error comes at the last line so something should be wrong with $mu1 but can't figure out my mistake:
StatusCode: 204
StatusDescription: No Content

 

Link to comment
Share on other sites

4 hours ago, paddy75 said:

hi all,

this are my first steps to use the api.
My goal is to read the title from a nfo file, search the itemid with the api and refresh this item. To read the nfo is not the problem, my problem is how to call the api.

For testing i have the following code
 

$apikey = 'your-key'
$stringTitle = 'your-title'

$mu = 'http://emby-url:8096/users/youruser-id/items?NameStartsWith=' + $stringTitle + '&Recursive=true&api_key=' + $apikey

$EmbyID = Invoke-WebRequest -Method Get -Uri $mu -ContentType 'application/json'
$FormatEmbyID = $EmbyID.Content | ConvertFrom-Json
$IDOutput = $FormatEmbyID.Items.Id
Write-Host '---------------------------------'
Write-Host "Updating title: $stringTitle"
Write-Host "EmbyID is: $IDOutput"
Write-Host '---------------------------------'
	
$mu1 = 'http://emby-url:8096/Emby/Items/' + $IDOutput + '/Refresh?MetadataRefreshMode=Default&api_key=' + $apikey
Invoke-WebRequest -Method Post -Uri $mu1

It gives me back the correct itemid
Error comes at the last line so something should be wrong with $mu1 but can't figure out my mistake:
StatusCode: 204
StatusDescription: No Content

 

204 is a success response. All 2xx responses are.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...