Skip to content

How to use ApiKey in ajax call? #5505

Closed Answered by David-Maisonave
David-Maisonave asked this question in Q&A
Discussion options

You must be logged in to vote

I figured it out. Need to do a ajaxSetup call before the ajax call.
Example:

	$.ajaxSetup({
		beforeSend: function(xhr) {
			xhr.setRequestHeader('apiKey', ApiKey);
		}
	});
    $.ajax({method: "POST", url: Url, contentType: "application/json", dataType: "text", cache: asyncAjax, async: asyncAjax,
	data: JSON.stringify({
			query: `mutation RunPluginOperation($plugin_id:ID!,$args:Map!){runPluginOperation(plugin_id:$plugin_id,args:$args)}`,
			variables: {"plugin_id": "DupFileManager", "args": { "Target" : ActionID, "mode":Mode}},
		}), success: function(result){

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stg-annon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant