What’s in the file
- OpenAPI 3.0.3, with the server
https://postsyncer.com/api/v1. The upload endpoint names its own server, the upload host (below). - Bearer authentication,
bearerAuth: send your key asAuthorization: Bearer YOUR_API_KEY. - Every endpoint, each with an
operationIdsuch aslistPostsorcreatePost, and one tag for its group, such asPostsorMedia. x-permissionon each endpoint: the key permission it needs, such asposts:read. An endpoint that can schedule or publish lists those permissions too.- Request and response examples, with made-up data, and a schema for each object.
POST /media/upload/file (uploadMediaFile) goes to https://upload.postsyncer.com/api/v1, with the same key, and the file names that host on the endpoint. Some tools ignore a server set on one endpoint and send every request to the main address: check the upload request’s address after you import.
Import into Postman
- In Postman, click Import.
- Paste
https://docs.postsyncer.com/api-reference/openapi.jsonand choose to import it as a Postman Collection. - Open the new collection’s Authorization tab, choose Bearer Token, and put in your key. Store it in a variable or a vault secret rather than in the collection, so it isn’t shared with it.
- Check the upload request’s address. If it isn’t
https://upload.postsyncer.com/api/v1/media/upload/file, change it to that.
Import into Insomnia
- In Insomnia, choose Import.
- Paste the URL, or pick the file if you downloaded it.
- Set Bearer authentication with your key on the requests, and check the upload request’s address, as in Postman.
Generate a client
Any OpenAPI 3.0 generator reads the file. This example makes a TypeScript client with OpenAPI Generator, which needs Java:PostsApi, MediaApi, WorkspacesApi…) and names each method after its operationId. List your workspaces:
uploadMediaFile calls the main address, your generator ignored the endpoint’s server. Then make a second Configuration with basePath: "https://upload.postsyncer.com/api/v1" and call uploadMediaFile through a MediaApi made with it.
Generate the client again when the API changes. The changelog says what changed, and versioning says what we add without notice: new fields, endpoints and values. Write your code so a field or value it doesn’t know doesn’t break it.
Related
API reference
Every endpoint, with a playground to try it.
CLI
Send the same requests from a terminal.