Cant get JSON method


#1

HI guys, I am totally unable to get valid json get url … localhost/wp-admin/admin-ajax.php?action=rtmedia_api&method=rtmedia_gallery&token=1c1486ad94f3eb155ce52d3dfe0842292ca4f0a1&media_type=photo&global=true

getting

{“status”:“FALSE”,“status_code”:600001,“message”:“no method specified”,“data”:false}

what am I doing wrong?)

thanks


#2

@tomasvrana,
Can you tell me what exactly you trying to achieve?
Also check this doc -> https://rtcamp.com/rtmedia/docs/developer/json-api/ for more detail on rtMedia JSON API.


#3

Im trying to load simply some gallery of a user … maybe Im doing that totally wrong (picture) … how to do so right pls?)

thanks
TV

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/66589/2014/06/Snímek-obrazovky-2014-06-15-v-22.02.46.jpg


#4

You need to send all the parameters in post method, not in get method.
I just tried with post method and is working fine.


#5

Sorry for extended stupidity, but I just dont get it.) … I simly need to GET a gallery object of any given user id. So that I can do what i want. Preferably in php … however JSON API documentation is the only one you have. Apart from WP reference it isnt very clear to me. Sorry. :slight_smile:
I bet Im using it totally wrong, but I just need to GET it.
Shortcode isnt sufficient in this way and I need the object only. So that I can render what I want. Cant figure this out.

best if you had classic stuff like rtmedia_get_gallery($userid,$mediatype,…);

if you can, post some example please

tnx


#6

@tomasvrana,
I am just saying that you are using “GET” method to fetch the media but instead you need to use “POST” method to fetch the media. What you are doing is passing parameters in query string but that’s wrong, you have to make an ajax POST request with those parameters.

What exactly the output you want? May be that way I can help you.


#7

Hi, so trying this:

	$.ajax({  
		type: "POST",  
		url: 'http://localhost/wp/wp-admin/admin-ajax.php',  
		action: 'rtmedia_api',  
		method: 'rtmedia_gallery',  
		token: '1c1486ad94f3eb155ce52d3dfe0842292ca4f0a1',  
		success:function(data){   
			console.log(data);  
			  
		}  
	});  

with no significant results…

what I need is make these https://rtcamp.com/rtmedia/docs/developer/json-api/#get-media-methods working.

simply get users images/audio whatever. I know that Im doing it wrong because it truly doesnt work :smiley: Can you please post working dummy example of fetching photos from user 1… ?

thx
TV


#8

What output you are getting in this ajax call?


#9

0

… can you pls post working example? this although consists the main vars results in zero.
Also would welcome something in php, js is too browser. However anyhow I can load members files is welcome.

As this is taking quite too many replies please post a working snippet from your side. Ill customize.

Tnx :slight_smile:

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/66834/2014/06/Snímek-obrazovky-2014-06-21-v-20.58.52.jpg


#10

@tomasvrana,
First you need to create an ajax call (Parameters{action: rtmedia_api, method: wp_login, username: user_name, password: password}) in which you will get access token. By using that access token you can actually use rtMedia json API.
To upload media you need to make an ajax call with these parameters(action: rtmedia_api, method: rtmedia_upload_media, token: access_token_from_previous_call, rtmedia_file: base64_encoded_file, context: context, title: media_title, image_type: image_format{jpeg/png})

Also check this document -> https://rtcamp.com/rtmedia/docs/developer/json-api/ for more available options.

Also check this support thread -> https://rtcamp.com/support/topic/upload-api-via-ajax/


#11

Hi

  1. Ive no interest in upload.
  2. please read what I write and POST me working example!
  3. Ive looked in your JSON API documentation enough. If it had examples (like WP ref) I may not be desperatedly hunting you!
  4. To ensure again (although mentioned since begining):
    PLEASE POST A WORKING EXAMPLE OF GETTING IMAGES FROM USER 1 (default). Ive posted example of mine, obviously wrong one, so please POST a correct one!
  5. PLEASE!!!
  6. Sorry to be almost rude but we are wasting each others time and if I ask you to help with exact thing, I expect to be helped with that. NOT WITH UPLOAD! ONLY GET! IMAGES! USER1!

#12

Sorry for your inconvenience. To get media of user with user_id = 1 you need to pass following parameters.

action: rtmedia_api,   
method: rtmedia_gallery,   
token: access_token_from_previous_call,   
media_type: photo,  
media_author: 1

#13

Something is making fun of me!)))
Surely I tried that as:

$.ajax({
type: “POST”,
url: ‘http://localhost/muse/wp-admin/admin-ajax.php’,
action: ‘rtmedia_api’,
method: ‘rtmedia_gallery’,
token: ‘1c1486ad94f3eb155ce52d3dfe0842292ca4f0a1’,
media_type: ‘photo’,
media_author: 1,
success:function(data){
console.log(data);

		}  
	});  

but that responds with 0 as well.

maybe I have to try it online. God damn this is frustrating!

Lets leave it for now. Tnx

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/66880/2014/06/Snímek-obrazovky-2014-06-23-v-20.58.28.jpg


#14

Something is making fun of me!)))
Surely I tried that as:

$.ajax({
type: “POST”,
url: ‘http://localhost/muse/wp-admin/admin-ajax.php’,
action: ‘rtmedia_api’,
method: ‘rtmedia_gallery’,
token: ‘1c1486ad94f3eb155ce52d3dfe0842292ca4f0a1’,
media_type: ‘photo’,
media_author: 1,
success:function(data){
console.log(data);

		}  
	});  

but that responds with 0 as well.

maybe I have to try it online. God damn this is frustrating!D

Lets leave it for now. Tnx

Attachment Link(s):

http://rtcamp.com/wp-content/uploads/rtMedia/topics/66882/2014/06/Snímek-obrazovky-2014-06-23-v-20.58.28.jpg


#15

@tomasvrana,
I am really sorry that it didn’t worked for you.

We use postman rest client addon in chrome browser to check API functioning.

You should first check with this chrome addon.


#16