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 » or whatever (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 my case, i have used, a dotnet snippet inside the function (Invoke .NET) and the website lti.tools/oauth/ to understand the OAuth1 algorithm
(*) In other to get the information on how to generate Magento OAuth1 signature, please check the link below (« The OAuth Signature »)
The idea is that my function is returning a string formatted like below
OAuth oauth_consumer_key= » »,oauth_token= » »,oauth_signature_method= »HMAC-SHA256″,oauth_timestamp= » »+timeStamp+ » »,oauth_nonce= » »+nonce+ » »,oauth_version= »1.0″,oauth_signature= » »+encodedsignature+ » »
where variables (timestamp, nonce , encodedsignature) are calculated in the code of the function.
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 above