Spotify XML request - xmlhttprequest

I try to do a XMLHTTPrequest to: http://lyricwiki.org/api.php?artist=" + encodeURIComponent(artistName) + "&song=" + encodeURIComponent(songName) + "&fmt=xml
to get the lyrics
but when I look in the inspector Spotify the request status is 0
what can I do?

A fuller post of your code would help. But I will give this a shot with simplest tested example.
Require this permission in your manifest.json:
"RequiredPermissions": [
"http://lyricwiki.org"
],
IMPORTANT: Make sure the manifest.json file is utf-8 encoded with the proper \n only line breaks, and use a JSON linter to verify it is well formatted (http://jsonlint.com/)
Also, Be sure to restart the Spotify client after any changes to manifest.json.
This simple example worked for me:
$.post("http://lyricwiki.org/api.php" +
"?artist=" + encodeURIComponent("Beastie Boys") +
"&song=" + encodeURIComponent("Make Some Noise") +
"&fmt=xml", function (data) {
alert("Data loaded: " + data);
});

Related

Unable to convert rest assured test to karate test

I am trying to migrate one of api test to karate framework. However I am unable to write the corrent step defined in karate documentation. Maybe I am missing some basic syntax..but could anyone have any idea how we write following steps in karate feature
requestPostDoc.header("x-api-key","FG6dcYHN9N7PYKfWCUlGo5QGTwZhv2Re1MrDSOTV");//New chnages
requestPostDoc.contentType("multipart/form-data").multiPart("part2-file",file).formParam("part1-json",objDocumentWrite.toJSONString());
requestPostDoc.queryParam("loadProperties",true); //New changes
responseForNewCaseDocFile=requestPostDoc.post("https://vrh0oox3hl.execute-api.eu-central-1.amazonaws.com/default/");//New changes
filterableRequestSpecification = (FilterableRequestSpecification) requestPostDoc;
filterableRequestSpecification.removeQueryParam("loadProperties");
I have written following feature file in karate:
Given url 'https://vrh0oox3hl.execute-api.eu-central-1.amazonaws.com/default/'
And header x-api-key = 'FG6dcYHN9N7PYKfWCUlGo5QGTwZhv2Re1MrDSOTV'
And header Authorization = 'Bearer ' + jwt
And param loadProperties = true
And multipart file info = { read: 'classpath:testData/documentWrite.json', filename: 'documentWrite.json' }
And multipart file Uploading = { read: 'classpath:testData/TextFile.txt', filename: 'TextFile.txt' }
When method post
Then print response
Then status 200
When I execute this test i am getting 400 response code
status code was: 400, expected: 200, response time in milliseconds: 252, url: https://vrh0oox3hl.execute-api.eu-central-1.amazonaws.com/default/?loadProperties=true, response:
Based on the cURL command in the comments, this is my best guess. The rest is up to your research. Read the docs and tweak the Content-Type and other sub-headers if needed. You need to figure this out depending on what your server wants: https://github.com/karatelabs/karate#multipart-file
* multipart file part1-json = { read: 'documentWrite.json' }
* multipart file part2-file = { read: 'TextFile.txt' }
For anyone coming across this question in the future and if you are stuck, get a friend if needed and go through this exercise together: https://github.com/karatelabs/karate/issues/1645#issuecomment-862502881
This stuff can be hard and needs time. There are no short cuts.

Axios get : response with 403 error forbidden

I'm trying to use Open API in Vue.js.
When the webpage was created, i just wanna check the fetched data on console log.
This is the error image. enter image description here
And this is Network tab. enter image description here
code
created() {
const request = require("request");
const SERVIECE_KEY =" blah blah"; // secret
let url =
"https://cors-anywhere.herokuapp.com/http://openapi.molit.go.kr:8081/OpenAPI_ToolInstallPackage/service/rest/RTMSOBJSvc/getRTMSDataSvcAptTrade";
// use 'herokuapp' as a proxy server
let queryParams =
"?" +
encodeURIComponent("serviceKey") +
`=${SERVIECE_KEY}`;
queryParams +=
"&" +
encodeURIComponent("LAWD_CD") +
"=" +
encodeURIComponent("11110");
queryParams +=
"&" +
encodeURIComponent("DEAL_YMD") +
"=" +
encodeURIComponent("201512");
request(
{
url: url + queryParams,
method: "GET",
},
function (error, response, body) {
console.log("Status", response.statusCode);
console.log("Headers", JSON.stringify(response.headers));
console.log("Reponse received", body);
}
);
},
Try
The same request works on Postman with encoded service key (no proxy server URL).
it works on a browser as well.
Use decoded and encoded service key both above the code to check if the URL i entered is wrong
I know 403 error(forbidden) is due to the permission to access.
But i really don't know what could be the problem.

Cloud Recoding RESTful API Error of Agora.io

I would like to implement your Cloud Recoding of Live Broadcasting via RESTful API. I implemented it with NodeJs. Could you please help me why I get an error and how I can fix it?
On the manual,
"Status Code 400: The input is in the wrong format."
But I do not know what is wrong.
error: null
body: { resourceId: '', code: 400 }
var plainCredentials = new Buffer.from(agoraCustomerId+":"+agoraCustomerCertificate);
var base64Credentials = plainCredentials.toString("base64");
var options = {
url: "https://api.agora.io/v1/apps/AGORA_APP_ID/cloud_recording/acquire",
method: "POST",
headers: {
"Authorization": "Basic " + base64Credentials,
"Content-type": "application/json;charset=utf-8"
},
body:{
"cname": "190724060650293",
"uid": "060716332",
"clientRequest": {}
}
};
request.post(options, function (error, response, body) {
console.log("error: " + error);
console.log("body: ", body);
});
Agora's Cloud Recording is an add-on feature so it's not enabled by default, it needs to be enabled on your account for a specific AppID. The error you may be receiving is because the feature is not enabled on your account.
UPDATE:
Enabling Agora.io's Cloud Recording on your project is now available through the Agora.io Dashboard.
To enable Cloud Recording on your project, you’ll need to click into the Products & Usage section of the Agora.io Dashboard and select the Project name from the drop-down in the upper left-hand corner, click the Duration link below Cloud Recording.
After you click Enable Cloud Recording, you will be prompted to confirm the concurrent channels settings which defaults to 50, but you can contact sales#agora.io if you need more.
Theres a getting started tutorial that leverages a POSTMAN collection for quick testing.
QuickStart Tutorial: https://medium.com/#hermes_11327/agora-cloud-recording-quickstart-guide-with-postman-demo-c4a6b824e708
Postman Collection: https://documenter.getpostman.com/view/6319646/SVSLr9AM?version=latest
In my case it was mistake in Region settings . I used AP_NORTHEAST_1 but 10 need be used
1 - Make sure you have enable agora recording
2- Check the link and send all parameters.
https://docs-preprod.agora.io/en/cloud-recording/cloud_recording_webpage_mode?platform=RESTful
EX: {
"cname": "httpClient463224",
"uid": "527841",
"clientRequest":{
"resourceExpiredHour": 24,
"scene": 1
}
}
You forgot to put "resourceExpiredHour": 24,"scene": 1
More info:
PHP: you need to put strval function
$body = ["cname"=>strval($cname),"uid" =>strval($uid),"clientRequest" => ["resourceExpiredHour" => 24,"scene" => 1]];
I hope you solve your issue

Question mark at the end of GET url in Chrome Debugging

In my React Native app I'm sending a GET request to a backend server to fetch some data. This is how I create a destination URL:
get(config.PACKAGES_URL + '?uuid=' + uuid + '&type=P12&purpose=MAINTENANCE', {}, {Authorization: token})
and this get function is defined as
get = (url, params, headers) => (
fetch(`${url}?${queryString.stringify(params)}`, {
method: 'GET',
headers: headers,
})
The URL is created properly, but Debugger shows me that it also has a question mark ( "?" ) at the very end. That messes up the request and causes the backend not being able to process it. Is there a way to remove that question mark? I suppose it's debugger related problem and when I would switch to release I wouldn't get this. I need to be on the debugger mode though.
EDIT: Got it fixed by moving the uuid, type and purpose from URL do BODY. So now it looks like this:
get(config.PACKAGES_URL,
{
uuid: uuid,
type: 'P12',
purpose: 'MAINTENANCE'
}, {Authorization: token})

Trello API - Unauthorized permission request

I am trying to write a little script to update cards with the amount of time the card has been on the list it is currently on, so we can optimize our throughput. I wrote a little script on jsfiddle that almost works, but I'm getting a "unauthorized card permission requested" when trying to use:
Trello.post("cards/" + card.id + "/actions/comments", {text: "This card has been in this list for " + ago + " days."})
or...
Trello.put("cards/" + card.id + "/name", "(" + ago + ") " + card.name);
Here is the fiddle, if that helps: http://jsfiddle.net/A3Xgk/2/
Any ideas? Thanks!
Try request your app token from
https://trello.com/1/connect?key=yourkey&name=your_board_name&expiration=never&response_type=token&scope=read,write
reference:
https://github.com/zmilojko/git-trello
The "unauthorized card permission" that is being requested is the write permission
In your jsfiddle example, when the "Connect to Trello" window pops up, you'll notice it says
The app will be able to:
Read all of your boards and organizations
It won't be able to:
Create and update cards, lists and boards
Make comments for you
Read your email address
See your Trello password
You need to request a token that has write permissions, which you can do by changing the scope parameter to Trello.authorize:
$("#connectLink").click(function() {
Trello.authorize({
type: "popup",
scope: { read: true, write: true },
success: onAuthorize
});
});
(The default value for scope in the source for client.js is { read: true, write: false })