Create flow with multiple independent instructions - opendaylight

I want to create a flow with two independent instructions:
forward to a specific out port
add a vlan tag and forward to another port
Is this possible?
When I try to add this flow:
Flow [_bufferId=4294967295, _cookie=FlowCookie [_value=3098476543630901248], _flags=FlowModFlags [_cHECKOVERLAP=false, _rESETCOUNTS=false, _nOPKTCOUNTS=false, _nOBYTCOUNTS=false, _sENDFLOWREM=false], _flowName=sde-1-L2switch-2, _hardTimeout=0, _id=Uri [_value=sde-1-L2switch-2], _idleTimeout=0, _instructions=Instructions [_instruction=[Instruction [_instruction=ApplyActionsCase [_applyActions=ApplyActions [_action=[Action{getAction=OutputActionCase{getOutputAction=OutputAction{getMaxLength=65535, getOutputNodeConnector=Uri [_value=2], augmentations={}}, augmentations={}}, getOrder=0, augmentations={}}], augmentation=[]], augmentation=[]], _key=InstructionKey [_order=0], _order=0, augmentation=[]], Instruction [_instruction=ApplyActionsCase [_applyActions=ApplyActions [_action=[Action [_action=PushVlanActionCase [_pushVlanAction=PushVlanAction [_ethernetType=33024, augmentation=[]], augmentation=[]], _key=ActionKey [_order=0], _order=0, augmentation=[]], Action [_action=SetFieldCase [_setField=SetField [_vlanMatch=VlanMatch [_vlanId=VlanId [_vlanId=VlanId [_value=999], _vlanIdPresent=true, augmentation=[]], augmentation=[]], augmentation=[]], augmentation=[]], _key=ActionKey [_order=1], _order=1, augmentation=[]], Action [_action=OutputActionCase [_outputAction=OutputAction [_maxLength=65535, _outputNodeConnector=Uri [_value=openflow:5:2], augmentation=[]], augmentation=[]], _key=ActionKey [_order=2], _order=2, augmentation=[]]], augmentation=[]], augmentation=[]], _key=InstructionKey [_order=1], _order=1, augmentation=[]]], augmentation=[]], _key=FlowKey [_id=Uri [_value=sde-1-L2switch-2]], _match=Match{getEthernetMatch=EthernetMatch{getEthernetDestination=EthernetDestination{getAddress=MacAddress [_value=00:00:00:00:00:02], augmentations={}}, getEthernetSource=EthernetSource{getAddress=MacAddress [_value=00:00:00:00:00:01], augmentations={}}, augmentations={}}, augmentations={}}, _priority=100, _tableId=0, augmentation=[]]
I get the following error:
org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl - 0.5.3 | Message deserialization failed
java.lang.IllegalStateException: Deserializer for key: msgVersion: 4 objectClass: org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage msgType: 65535 experimenterID: 8992 was not found - please verify that all needed deserializers ale loaded correctly
at org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializerRegistryImpl.getDeserializer(DeserializerRegistryImpl.java:69)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory.deserialize(ErrorMessageFactory.java:57)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at org.opendaylight.openflowjava.protocol.impl.deserialization.factories.ErrorMessageFactory.deserialize(ErrorMessageFactory.java:41)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at org.opendaylight.openflowjava.protocol.impl.deserialization.DeserializationFactory.deserialize(DeserializationFactory.java:54)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at org.opendaylight.openflowjava.protocol.impl.core.OFDecoder.decode(OFDecoder.java:51)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at org.opendaylight.openflowjava.protocol.impl.core.OFDecoder.decode(OFDecoder.java:27)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)[53:io.netty.codec:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)[58:io.netty.transport:4.1.8.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)[53:io.netty.codec:4.1.8.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)[53:io.netty.codec:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)[58:io.netty.transport:4.1.8.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)[53:io.netty.codec:4.1.8.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)[53:io.netty.codec:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)[58:io.netty.transport:4.1.8.Final]
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287)[56:io.netty.handler:4.1.8.Final]
at org.opendaylight.openflowjava.protocol.impl.core.IdleHandler.channelRead(IdleHandler.java:37)[317:org.opendaylight.openflowplugin.openflowjava.openflow-protocol-impl:0.5.3]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:341)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:129)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:642)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:565)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:479)[58:io.netty.transport:4.1.8.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:433)[58:io.netty.transport:4.1.8.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)[55:io.netty.common:4.1.8.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)[55:io.netty.common:4.1.8.Final]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_144]
Thanks in advance!
Max

Fixed by creating a common list of actions in one single instruction.

Related

Mint Edition from MasterEdition says account is missing

I am working on a project to create nfts and print editions afterwards. The nft minting and metadata creating works just fine. I just don't know why the edition printing is not working.
I am trying to mint a edition from a master edition with the following metaplex function:
let accounts = vec![
ctx.accounts.new_metadata.to_account_info(),
ctx.accounts.new_edition.to_account_info(),
ctx.accounts.master_edition.to_account_info(),
ctx.accounts.new_mint.to_account_info(),
ctx.accounts.edition_mark_pda.to_account_info(),
ctx.accounts.new_mint_authority.to_account_info(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.token_account_owner.to_account_info(),
ctx.accounts.token_account.to_account_info(),
ctx.accounts.new_metadata_update_authority.to_account_info(),
ctx.accounts.metadata.to_account_info(),
ctx.accounts.token_program.to_account_info(),
ctx.accounts.system_program.to_account_info(),
ctx.accounts.rent.to_account_info(),
];
invoke(
&mint_new_edition_from_master_edition_via_token(
ctx.accounts.token_metadata_program.key(),
ctx.accounts.new_metadata.key(),
ctx.accounts.new_edition.key(),
ctx.accounts.master_edition.key(),
ctx.accounts.new_mint.key(),
ctx.accounts.new_mint_authority.key(),
ctx.accounts.payer.key(),
ctx.accounts.token_account_owner.key(),
ctx.accounts.token_account.key(),
ctx.accounts.new_metadata_update_authority.key(),
ctx.accounts.metadata.key(),
ctx.accounts.metadata.key(),
1,
),
&accounts,
)?;
Unfortunatly I always receive this error:
'Program log: Instruction: MintEdition',
'Instruction references an unknown account F5mAJWXVpQ4rupmvMGTY7ZDqK7UUzSkS7dTfTRX6WMLf',
'Program 4euwMgqxB9GkxVBY7uXKRRuC68yhkNbsVUhDPYS1mbhD consumed 18852 of 200000 compute units',
'Program 4euwMgqxB9GkxVBY7uXKRRuC68yhkNbsVUhDPYS1mbhD failed: An account required by the instruction is missing'
My function call from the frontend looks like the following:
await program.methods
.mintEdition()
.accounts({
newMetadata: metadataAddress,
newEdition: newEditionAddress,
masterEdition: masterEditionAddress,
newMint: newMint.publicKey,
editionMarkPda: editionMarkPda,
newMintAuthority: provider.wallet.publicKey,
payer: provider.wallet.publicKey,
tokenAccountOwner: provider.wallet.publicKey,
tokenAccount: ata,
newMetadataUpdateAuthority: provider.wallet.publicKey,
metadata: metadataAddress,
tokenMetadataProgram: TOKEN_METADATA_PROGRAM_ID,
tokenProgram: TOKEN_PROGRAM_ID,
systemProgram: anchor.web3.SystemProgram.programId,
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
})
.rpc();
This is how I get the editionMarkPda in the frontend:
await anchor.web3.PublicKey.findProgramAddress(
[
Buffer.from("metadata"),
TOKEN_METADATA_PROGRAM_ID.toBuffer(),
masterEditionMint.publicKey.toBuffer(),
Buffer.from("edition"),
Buffer.from("1"),
],
TOKEN_METADATA_PROGRAM_ID
)
Any ideas what is missing?

Getting "invalid_client" when using obtained oauth token (Microsoft) with phpmailer

Can't seem to get this working. Any idea why?
This is my MS configuration:
authentication
api/permissions
token configuration (empty)
"expose an api" (empty)
Code obtaining token (works fine):
new \Stevenmaguire\OAuth2\Client\Provider\Microsoft([
'clientId' => "my_id...",
'clientSecret' => "my_secret...",
'redirectUri' => "https://example.com/get/get_oauth_token.php",
'accessType' => 'offline',
// Optional (what is this doing??)
'urlAuthorize' => 'https://login.windows.net/common/oauth2/authorize',
'urlAccessToken' => 'https://login.windows.net/common/oauth2/token',
'urlResourceOwnerDetails' => 'https://outlook.office.com/api/v1.0/me'
]);
$authUrl = $provider->getAuthorizationUrl([
'scope' => ['wl.basic', 'wl.signin', 'wl.emails'] // no idea what I need here and what not - does it have to align with the app permissions?
]);
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
Using token to send mail:
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Timeout = 10;
$mail->Host = "smtp.office365.com"; // smtp.office365.com, outlook.office.com, smtp-mail.outlook.com which one is it even?? Doesnt make a difference
$mail->Port = 587;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->AuthType = 'XOAUTH2';
// (omitting all mail content stuff here)
$provider = new \Stevenmaguire\OAuth2\Client\Provider\Microsoft([
'clientId' => "my_id...",
'clientSecret' => "my_secret...",
'redirectUri' => "https://example.com/get/get_oauth_token.php" // is this necessary here?
]);
//Pass the OAuth provider instance to PHPMailer
$mail->setOAuth(
new OAuth([
'provider' => $provider,
'clientId' => "my_id...",
'clientSecret' => "my_secret...",
'refreshToken' => "my_refreshToken...",
// 'oauthToken' => $token, // ? are we completely ignoring the actual access token in all of this? do we ever need to update our refresh token?
'userName' => 'me#mycompany.onmicrosoft.com' // supposed to be user that gave consent?
])
);
$mail->send();
$mail->SmtpClose();
Getting this error:
2022-09-22 17:49:08 SERVER -> CLIENT: 220 FR0P281CA0070.outlook.office365.com Microsoft ESMTP MAIL Service ready at Thu, 22 Sep 2022 17:49:07 +0000
2022-09-22 17:49:08 CLIENT -> SERVER: EHLO example.com
2022-09-22 17:49:08 SERVER -> CLIENT: 250-FR0P281CA0070.outlook.office365.com Hello [85.13.129.169]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-09-22 17:49:08 CLIENT -> SERVER: STARTTLS
2022-09-22 17:49:08 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2022-09-22 17:49:08 CLIENT -> SERVER: EHLO example.com
2022-09-22 17:49:08 SERVER -> CLIENT: 250-FR0P281CA0070.outlook.office365.com Hello [85.13.129.169]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
Bad Request
/www/htdocs/w014af32/me/vendor/stevenmaguire/oauth2-microsoft/src/Provider/Microsoft.php(79)
#0 /www/htdocs/w014af32/me/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(628): Stevenmaguire\OAuth2\Client\Provider\Microsoft->checkResponse(Object(GuzzleHttp\Psr7\Response), Array)
#1 /www/htdocs/w014af32/me/vendor/league/oauth2-client/src/Provider/AbstractProvider.php(537): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request))
#2 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/OAuth.php(115): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\RefreshToken), Array)
#3 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/OAuth.php(128): PHPMailer\PHPMailer\OAuth->getToken()
#4 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/SMTP.php(598): PHPMailer\PHPMailer\OAuth->getOauth64()
#5 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/PHPMailer.php(2190): PHPMailer\PHPMailer\SMTP->authenticate('', '', 'XOAUTH2', Object(PHPMailer\PHPMailer\OAuth))
#6 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/PHPMailer.php(2003): PHPMailer\PHPMailer\PHPMailer->smtpConnect(Array)
#7 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/PHPMailer.php(1662): PHPMailer\PHPMailer\PHPMailer->smtpSend('Date: Thu, 22 S...', 'test content\r\n')
#8 /www/htdocs/w014af32/me/vendor/phpmailer/phpmailer/src/PHPMailer.php(1500): PHPMailer\PHPMailer\PHPMailer->postSend()
#9 /www/htdocs/w014af32/me/includes/helpers/mail.php(182): PHPMailer\PHPMailer\PHPMailer->send()
#10 /www/htdocs/w014af32/me/includes/helpers/mail.php(113): mailSendSingle(Object(PHPMailer\PHPMailer\PHPMailer), Array, true)
#11 /www/htdocs/w014af32/me/get/test4.php(25): mailSend(Array)
#12 {main}
# Args:
checkResponse: [{},{"error":"invalid_client","error_description":"The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https:\/\/go.microsoft.com\/fwlink\/?linkid=2083908.","correlation_id":"4dc377bd-0d5d-4444-bdd4-82b862f86177"}]
getParsedResponse: [{}]
getAccessToken: [{},{"refresh_token":"my refreshToken..."}]
authenticate: ["","","XOAUTH2",{}]
smtpConnect: [{"ssl":{"verify_peer":false,"verify_peer_name":false,"allow_self_signed":true}}]
smtpSend: ["Date: Thu, 22 Sep 2022 19:49:08 +0200\r\nTo: John Doe <me#example.com>\r\nFrom: John Doe <me#mycompany.onmicrosoft.com>\r\nReply-To: John Doe <me#mycompany.onmicrosoft.com>\r\nSubject: test mail\r\nMessage-ID: <AAtH5DrcPQ9Fn4PysOdjIt0OnDbByC4eaRYVnJh33M#example.com>\r\nX-Mailer: PHPMailer 6.6.4 (https:\/\/github.com\/PHPMailer\/PHPMailer)\r\nMIME-Version: 1.0\r\nContent-Type: text\/html; charset=utf-8\r\n\r\n","test content\r\n"]
mailSendSingle: [{"Priority":null,"CharSet":"utf-8","ContentType":"text\/html","Encoding":"7bit","ErrorInfo":"","From":"me#mycompany.onmicrosoft.com","FromName":"John Doe","Sender":"me#mycompany.onmicrosoft.com","Subject":"test mail","Body":"test content","AltBody":"","Ical":"","WordWrap":0,"Mailer":"smtp","Sendmail":"\/usr\/sbin\/sendmail","UseSendmailOptions":true,"ConfirmReadingTo":"","Hostname":"","MessageID":"","MessageDate":"","Host":"smtp.office365.com","Port":"587","Helo":"","SMTPSecure":"tls","SMTPAutoTLS":true,"SMTPAuth":true,"SMTPOptions":{"ssl":{"verify_peer":false,"verify_peer_name":false,"allow_self_signed":true}},"Username":"","Password":"","AuthType":"XOAUTH2","Timeout":10,"dsn":"","SMTPDebug":2,"Debugoutput":"html","SMTPKeepAlive":false,"SingleTo":false,"do_verp":false,"AllowEmpty":false,"DKIM_selector":"","DKIM_identity":"","DKIM_passphrase":"","DKIM_domain":"","DKIM_copyHeaderFields":true,"DKIM_extraHeaders":[],"DKIM_private":"","DKIM_private_string":"","action_function":"","XMailer":""},{"from_mail":"me#mycompany.onmicrosoft.com","from_name":"John Doe","smtp_profile":3,"from_user":1,"to_mail":"me#example.com","to_name":"John Doe","to_type":"staff","to_id":3,"template":0,"debug":true,"testing":true,"subject":"test mail","type":"test","date":"2022-09-22 19:49:08","content":"test content","reply_to":"me#mycompany.onmicrosoft.com"},true]
mailSend: [{"from_mail":"me#mycompany.onmicrosoft.com","from_name":"John Doe","smtp_profile":3,"from_user":1,"to_mail":"me#example.com","to_name":"John Doe","to_type":"staff","to_id":3,"template":0,"debug":true,"testing":true,"subject":"test mail","type":"test","date":"2022-09-22 19:49:08","content":"test content","reply_to":"me#mycompany.onmicrosoft.com"}]
2022-09-22 17:49:08 CLIENT -> SERVER: QUIT
2022-09-22 17:49:08 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
I know it's a lot of code but there isn't really much to say, I could ommit the whole token obtaining because it works. I assume the error lies somewhere in the azure configuration? The user I've obtained the token with is just a "member" (Role "Global administrator"), the "owner" of the app is another one.
using these options for the provider (in both places, aquiring token and sending mail) did it (it's the tenant id):
'urlAuthorize' => 'https://login.microsoftonline.com/b3095h58-5987-4489-a1dd-b132f2f38113/oauth2/authorize',
'urlAccessToken' => 'https://login.microsoftonline.com/b3095h58-5987-4489-a1dd-b132f2f38113/oauth2/token'
It seemed irrelevant whether to use windows.net or microsoftonline.com
However now I'm at the same point as described here. Funnily even using Thunderbird to test the oauth authentification fails for sending (receiving is fine though).

IMDbPY can't get age restriction

I can't find how to get the pc rating or age restriction from imbdPy. Can someone assist please. Looking for Age restriction and whether it has one or more of VLSNP. If it's not in this dictionary does it mean it doesn't store it?
{
'tv schedule': 'airing',
'user rating': 'rating',
'plot summary': 'plot',
'plot summaries': 'plot',
'directed by': 'director',
'created by': 'creator',
'writing credits': 'writer',
'produced by': 'producer',
'original music by': 'original music',
'non-original music by': 'non-original music',
'music': 'original music',
'cinematography by': 'cinematographer',
'cinematography': 'cinematographer',
'film editing by': 'editor',
'film editing': 'editor',
'editing': 'editor',
'actors': 'cast',
'actresses': 'cast',
'casting by': 'casting director',
'casting': 'casting director',
'art direction by': 'art direction',
'set decoration by': 'set decoration',
'costume design by': 'costume designer',
'costume design': 'costume designer',
'makeup department': 'make up',
'makeup': 'make up',
'make-up': 'make up',
'production management': 'production manager',
'production company': 'production companies',
'second unit director or assistant director':
'assistant director',
'second unit director': 'assistant director',
'sound department': 'sound crew',
'costume and wardrobe department': 'costume department',
'special effects by': 'special effects',
'visual effects by': 'visual effects',
'special effects company': 'special effects companies',
'stunts': 'stunt performer',
'other crew': 'miscellaneous crew',
'misc crew': 'miscellaneous crew',
'miscellaneouscrew': 'miscellaneous crew',
'crewmembers': 'miscellaneous crew',
'crew members': 'miscellaneous crew',
'other companies': 'miscellaneous companies',
'misc companies': 'miscellaneous companies',
'miscellaneous company': 'miscellaneous companies',
'misc company': 'miscellaneous companies',
'other company': 'miscellaneous companies',
'aka': 'akas',
'also known as': 'akas',
'country': 'countries',
'production country': 'countries',
'production countries': 'countries',
'genre': 'genres',
'runtime': 'runtimes',
'lang': 'languages',
'color': 'color info',
'cover': 'cover url',
'full-size cover': 'full-size cover url',
'seasons': 'number of seasons',
'language': 'languages',
'certificate': 'certificates',
'certifications': 'certificates',
'certification': 'certificates',
'miscellaneous links': 'misc links',
'miscellaneous': 'misc links',
'soundclips': 'sound clips',
'videoclips': 'video clips',
'photographs': 'photo sites',
'distributor': 'distributors',
'distribution': 'distributors',
'distribution companies': 'distributors',
'distribution company': 'distributors',
'guest': 'guests',
'guest appearances': 'guests',
'tv guests': 'guests',
'notable tv guest appearances': 'guests',
'episodes cast': 'guests',
'episodes number': 'number of episodes',
'amazon review': 'amazon reviews',
'merchandising': 'merchandising links',
'merchandise': 'merchandising links',
'sales': 'merchandising links',
'faq': 'faqs',
'parental guide': 'parents guide',
'frequently asked questions': 'faqs'}
No, that's just a list of aliases for some keywords.
The keys you are looking for are:
certificates
mpaa
An example:
>>> import imdb
>>> ia = imdb.IMDb()
>>> he = ia.get_movie('3460252') # The Hateful Eight
>>> print he.get('mpaa')
Rated R for strong bloody violence, a scene of violent sexual content, language and some graphic nudity
>>> print he.get('certificates')
[u'Argentina:16::(with warning)', u'Australia:R18+', u'Austria:16', u'Brazil:18', u'Canada:18A::(Alberta/British Columbia/Manitoba/Ontario)', u'Canada:13+::(Quebec)', u'Chile:14', u'Czech Republic:15', u'Denmark:15', u'Finland:K-16', u'France:12::(with warning)', u'Germany:16', u'Hong Kong:III', u'Hungary:18', u'India:A', u'Ireland:18', u'Italy:T', u'Japan:R18+', u'Japan:R15+::(edited version)', u'Mexico:C', u'Netherlands:16', u'New Zealand:R18', u'Norway:15', u'Portugal:M/16', u'Russia:18+', u'Singapore:R21', u'South Korea:18', u'Spain:18', u'Sweden:15', u'Switzerland:16', u'Taiwan:R-18', u'Thailand:18', u'UK:18', u'USA:R::(certificate #50077)']
))))

Magento update inventory with REST

I Followed the instruction of this page http://www.magentocommerce.com/api/rest/Resources/inventory.html#RESTAPI-Resource-StockItems-HTTPMethod-PUT-stockitems--id and I have this code:
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = $apiUrl.'/stockitems/429';
$productData = json_encode(array(
'qty' => 982,
'is_in_stock' => 1
));
$headers = array('Content-Type' => 'application/json');
$oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
print_r($oauthClient->getLastResponseInfo());
But I get the return
[message:protected] => Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
I tried with XML like this:
$oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
$resourceUrl = $apiUrl.'/stockitems/429';
$productData = '<?xml version="1.0"?>
<magento_api>
<qty>99</qty>
</magento_api>';
$headers = array('Content-Type' => 'text/xml');
$oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
print_r($oauthClient->getLastResponseInfo());
and I get the error:
[message:protected] => Invalid auth/bad request (got a 405, expected HTTP/1.1 20X or a redirect)
I don't know what I'm doing wrong?
Thank you for your reply.
Another way to update item's quantity is to call the /products/:id API, method = PUT, with the following payload:
{"stock_data" : {"qty" : "123"}}
You are using POST instead of PUT. HTTP Post is used for creating items in Magento, but if you update an item (or inventory, image, whatever) by id you have to use PUT.
Make sure you assigned to your admin user REST role.
Configuring Permissions Step By Step:
System -> Web Services -> REST - Roles -> Create new role
System -> Web Services -> REST - Consumers -> Create a Consumer -> Copy Key & Secret to use in your App
System -> Permissions -> Your User -> REST Role -> Select and Save your Role

Params not being passed to method in Rails 3.0.3

I have another very puzzling question that has cropped up after my upgrade from Rails 2.3.4 to Rails 3.0.3.
I am calling a 'show' controller method with the following URL:
/verse/10
and I see this in the terminal
Started GET "/verse/10" for 127.0.0.1
at 2011-01-27 16:17:58 -0800
Processing by VersesController#show
as HTML
* Searching for verse with ID:
Rendered verses/show.html.erb within
layouts/application (76.6ms)
Completed 200 OK in 1006ms (Views:
125.4ms | ActiveRecord: 9.8ms)
The verse show method is very simple:
def show
logger.debug("*** Searching for verse with ID: #{params[:id]}")
#vs = Verse.find(params[:id])
end
The route is defined as follows:
match '/verse/:id', :to => 'verses#show', :as => 'verse'
The problem: the parameter, ID, which in this case is '10', is not being passed in to the controller method and so a 404 is being thrown because params[:id] is nil.
The output from "rake routes | grep verse" is as follows:
verse /verse/:id(.:format) {:controller=>"verses", :action=>"show"}
I've spent ages on this but feel as though I'm missing something very obvious.
Here is the full rake routes output:
login /login(.:format) {:controller=>"sessions", :action=>"new"}
logout /logout(.:format) {:controller=>"sessions", :action=>"destroy"}
register /register(.:format) {:controller=>"users", :action=>"create"}
signup /signup(.:format) {:controller=>"users", :action=>"new"}
activate /activate/:activation_code(.:format) {:activation_code=>nil, :controller=>"users", :action=>"activate"}
forgot_password /forgot_password(.:format) {:controller=>"passwords", :action=>"new"}
change_password /change_password/:reset_code(.:format) {:controller=>"passwords", :action=>"reset"}
open_id_complete GET /opensession(.:format) {:controller=>"sessions", :action=>"create"}
open_id_create GET /opencreate(.:format) {:controller=>"users", :action=>"create"}
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
new_user GET /users/new(.:format) {:action=>"new", :controller=>"users"}
edit_user GET /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
PUT /users/:id(.:format) {:action=>"update", :controller=>"users"}
DELETE /users/:id(.:format) {:action=>"destroy", :controller=>"users"}
passwords GET /passwords(.:format) {:action=>"index", :controller=>"passwords"}
POST /passwords(.:format) {:action=>"create", :controller=>"passwords"}
new_password GET /passwords/new(.:format) {:action=>"new", :controller=>"passwords"}
edit_password GET /passwords/:id/edit(.:format) {:action=>"edit", :controller=>"passwords"}
password GET /passwords/:id(.:format) {:action=>"show", :controller=>"passwords"}
PUT /passwords/:id(.:format) {:action=>"update", :controller=>"passwords"}
DELETE /passwords/:id(.:format) {:action=>"destroy", :controller=>"passwords"}
session POST /session(.:format) {:action=>"create", :controller=>"sessions"}
new_session GET /session/new(.:format) {:action=>"new", :controller=>"sessions"}
edit_session GET /session/edit(.:format) {:action=>"edit", :controller=>"sessions"}
GET /session(.:format) {:action=>"show", :controller=>"sessions"}
PUT /session(.:format) {:action=>"update", :controller=>"sessions"}
DELETE /session(.:format) {:action=>"destroy", :controller=>"sessions"}
quests GET /quests(.:format) {:action=>"index", :controller=>"quests"}
POST /quests(.:format) {:action=>"create", :controller=>"quests"}
new_quest GET /quests/new(.:format) {:action=>"new", :controller=>"quests"}
edit_quest GET /quests/:id/edit(.:format) {:action=>"edit", :controller=>"quests"}
quest GET /quests/:id(.:format) {:action=>"show", :controller=>"quests"}
PUT /quests/:id(.:format) {:action=>"update", :controller=>"quests"}
DELETE /quests/:id(.:format) {:action=>"destroy", :controller=>"quests"}
index /home(.:format) {:controller=>"verses", :action=>"index"}
starter_pack /starter_pack(.:format) {:controller=>"verses", :action=>"starter_pack"}
*verse /verse/:id(.:format) {:controller=>"verses", :action=>"show"}*
tag_cloud /tag_cloud(.:format) {:controller=>"verses", :action=>"tag_cloud"}
show_user_info /show_user_info(.:format) {:controller=>"admin", :action=>"show_user_info"}
show_tags /show_tags(.:format) {:controller=>"admin", :action=>"show_tags"}
contact /contact(.:format) {:controller=>"info", :action=>"contact"}
faq /faq(.:format) {:controller=>"info", :action=>"faq"}
tutorial /tutorial(.:format) {:controller=>"info", :action=>"tutorial"}
volunteer /volunteer(.:format) {:controller=>"info", :action=>"volunteer"}
leaderboard /leaderboard(.:format) {:controller=>"info", :action=>"leaderboard"}
stateboard /stateboard(.:format) {:controller=>"info", :action=>"stateboard"}
countryboard /countryboard(.:format) {:controller=>"info", :action=>"countryboard"}
referralboard /referralboard(.:format) {:controller=>"info", :action=>"referralboard"}
news /news(.:format) {:controller=>"info", :action=>"news"}
update_profile /update_profile(.:format) {:controller=>"profile", :action=>"update_profile"}
referrals /referrals/:id(.:format) {:controller=>"profile", :action=>"referrals"}
unsubscribe /unsubscribe/*email(.:format) {:controller=>"profile", :action=>"unsubscribe"}
edit_tag /edit_tag/:id(.:format) {:controller=>"tag", :action=>"edit_tag"}
tweets /tweets(.:format) {:controller=>"tweets", :action=>"index"}
load_progress /load_progress/:user(.:format) {:controller=>"chart", :action=>"load_progress"}
root /(.:format) {:controller=>"sessions", :action=>"new"}
home /home(.:format) {:controller=>"sessions", :action=>"new"}
/:controller(/:action(/:id))(.:format)
If you have the open_id_authentication plugin installed, that is likely interfering with your routes.

Resources