Goal : Generate Magento signature for OAuth1 and call Magento REST API with Magic xpi
1/ Prerequisites :
- Get your consumerKey, consumerSecret, tokenSecret and tokenValue from you Magento Admin
- Some Magic xpa knowledge
2/ Check with Postman that your Access REST API is working
Set “Version” with 1.0 and tick “Encode the parameters …”, Leave other parameters empty
2/ Generate the Magento signature with Magic xpi User Function
Open your Magic xpa Studio and create a new project , call it “userfunctions”
Define in the Main a new function and call it “GetMagentoSignature” (Function scope must be set to global.
Generate your HMAC256 within this function and generate your ecf file in “<Magic xpi directory>Runtime\User resources” directory
(*) In other to get the information on how to generate OAuth1 signature, please check the link (“The OAuth Signature”)
3/ Add in your FunctionDescription.en.xml file (“<Magic xpi directory>Studio), the xml portion below at the end of the file
4/ Create a Magic xpi project and create a REST Client resource
5/ Create a new flow
Define 2 fow variables (F.SignatureEncoded (alpha unlimited) and F.Url (alpha unlimited).
Drag and drop a Flow Data Connector and update the 2 flow variables like below
6/ Drag & Drop a REST Client connector after this step and configure it like below
7/ Execute the flow in Debug mode
You should see the Authorization header in the Flow variable F.SignatureEncoded with the oauth_signature generated
You should receive status code 200 with OK and the JSOn result of your query.
8/ https://developer.adobe.com/commerce/webapi/rest/quick-reference/
(*) In other to get the different Json schemas please check with the link below