Upload image on wordpress by api

finally we have an API documentation… :partying_face:
can you explain, what you are trying to do? creating a media item?

as a start, you could first try the LIST option, which should be simple to implement
GET /wp/v2/media
like this you can test, if your Authorization headers are correct…
and if you got that running, then continue with your other task…

and concerning Authentication, I would follow this

and use Basic Http Authentication…
see also here App Inventor Tutorials and Examples: File Download | Pura Vida Apps

Taifun

i already auth by jwt auth & using that token

i can get without authentication.i need post solution.to get i didn’t need to implement disposition in header but when i have to post then i have to use it

did you get the LIST option running together with your Authentication?
Taifun

without authentication i can get media.

get

.with this authentication i post blog post

probably one of these threads can help? https://stackoverflow.com/search?q=[wordpress]+file+type+is+not+permited+for+security+reasons
and in the header I would remove the double quotes around the filename…

Taifun

i read about this.you can see that i am uploading image .that was accepted by api.but shwoing this error.means i did wrong in block

For me, I’ve managed to upload to my WP site using WP “Application Password” and by following this guide.

and this is the blocks

3 Likes

I didn’t test it.but i think it will work it is.thank you

1 Like

showing an error

I tried this

Could it be something with the “auth by jwt” you are using? Mine works with “application password” which now builtin inside wordpress. I never used jwt for WP REST API.

Ok.i will cheak with that.can you sharean demo text of it. I don’t know how it should be

according to the error message it looks like your result from the ActivityStarter.AfterActivity event is an empty string?
what about debugging your blocks to find out the result?
Taifun

how to do that I don’t know

the most simple method to debug something is to display the result in a label, and generally use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun

From where can i get application password

Wordpress admin account password

@Taifun @Iman_Shad

It seems to me that you are API experts :slight_smile:
Do you have an IDEA for my API problem?
I would like to upload photos to my own server independently of Goole and Co.

I’m really desperate

THANK

Since wordpress 5.7.0 (if I’m not mistaken), pplication password is merged into wordpress core. If you guys work with wordpress rest API, try all endpoints before using it to kodular.Use tools like postman or insomnia

I can"t say much about wordpress as this is kodular forum.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.