Rest Api for Flash Talking - XML through POST
Hey Guys!
I need to push XML request through POST for flashtalking api.
Code below:
httprequest.addHeader('Authorization', 'Basic ' + DOMO.b64EncodeUnicode(metadata.account.username + ':' + metadata.account.password));
var res = httprequest.get('https://request.flashtalking.net/authenticate/xxxxxxxxappkey');
//token extraction
var token = res.substring(92, 124);
DOMO.log('token: ' + token);
httprequest.addHeader('Authorization', 'Basic ' + DOMO.b64EncodeUnicode('appkey' + '||' + 'devkey' + ':' + token));
var xml = '<?xml version="1.0"?>'+
'<request>' +
' <name>testapiclient23</name>' +
'</request>';
var post = httprequest.post('https://request.flashtalking.net/client',xml);
DOMO.log(' post : ' + post);
When I use:
var post = httprequest.post('https://request.flashtalking.net/client',xml);
Console gives me follwing error:
post : method POST must have a request body.
When I modify it to:
var post = httprequest.post('https://request.flashtalking.net/client',{body:xml});
Api response is:
<?xml version="1.0"?>
<response><request>client</request><function>create</function><error>args not complete:name</error><token>90f6e2a9d6f42c1d5ee44dc249c212f7</token><httpstatus>400</httpstatus><message>bad request.</message></response>
Error 400 - Bad request.
I am pretty sure that Flash Talki api doesn't recognize my XML request, not sure why though.
Any help will be appreciated.
0
Best Answer
-
0
This discussion has been closed.
Categories
- 7.7K All Categories
- 3 Connect
- 919 Connectors
- 244 Workbench
- 477 Transform
- 1.8K Magic ETL
- 60 SQL DataFlows
- 446 Datasets
- 38 Visualize
- 198 Beast Mode
- 2K Charting
- 8 Variables
- 1 Automate
- 348 APIs & Domo Developer
- 82 Apps
- Workflows
- 14 Predict
- 3 Jupyter Workspaces
- 11 R & Python Tiles
- 241 Distribute
- 59 Domo Everywhere
- 241 Scheduled Reports
- 15 Manage
- 36 Governance & Security
- 27 Product Ideas
- 1.1K Ideas Exchange
- Community Forums
- 14 Getting Started
- 1 Community Member Introductions
- 49 Community News
- 18 Event Recordings
- 579 日本支部