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.