WordPress:REST API

De BrapciWiki
Ir para navegação Ir para pesquisar

Instalar o autenticador

Baixe o arquivo (ZIP)

https://github.com/WP-API/Basic-Auth

No WordPress clique nos PlugIn e envio o arquivo ZIP.

API Posts

Ex: Usuário: fabico Senha: q6xtTyp7@WT2%SU3eUBxvhjpd%s

https://ufrgs.br/bibead/wp-json/
https://hospedagemphp2.ufrgs.br/fabico/wp-json/

ou

http://ufrgs.br/bibead/wp-json/wp/v2/posts

http://yourdomain.com/wp-json/wp/v2/posts/<ID>

Criando um Post

curl -X POST –user username:password http://yourdomain.com/wp-json/wp/v2/posts/<ID> -d ‘{“title”:”My New Title”}’
curl -X POST –u fabico:tTyp7@WT2%SU3eUBxvhjpd%s https://hospedagemphp2.ufrgs.br/fabico/wp-json/wp/v2/posts/1 -d "{'title':'My title','content':'My content','status':'publish'}"

API Pages

http://ufrgs.br/bibead//wp-json/wp/v2/pages

WordPress REST API Basic Auth curl -X GET –user username:password -i http://yourdomain.com/wp-json/wp/v2/posts?status=draft