Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/evref-bl/wordpress-pharo-api


https://github.com/evref-bl/wordpress-pharo-api

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Wordpress-Pharo-API

This is a client for the [WordpressAPI](https://developer.wordpress.org/rest-api/reference/posts/).

## Installation

```st
Metacello new
githubUser: 'Evref-BL' project: 'Wordpress-Pharo-API' commitish: 'main' path: 'src';
baseline: 'WordpressPharoAPI';
load
```

## Connect the API to Wordpress

The first step before querying is to connect to the Wordpress API.

```smalltalk
wordpressAPI := WordpressPharoAPI new.
wordpressAPI endpoint: ''.
wordpressAPI username: '' password: ''.
```

## Example

### Get recent posts

```smalltalk
wordpressAPI getPosts
```

### Publish a post

```smalltalk
myPost := WPPost new.
myPost date: DateAndTime tomorrow.
myPost status: 'draft'.
myPost title: 'FirstTest'.
myPost author: 28.
myPost content: 'First content'.

wordpressAPI createPost: myPost.
```