I've been fighting this one for awhile and finally got it to work in the iPad app I'm working on that creates sectors and uses the API to draw them in the app.
This particular example requests a subsector map, and returns an image (png, I believe).
However you generate this, something like this is what you want to send to the Poster API. Your headers will vary. See the docs at:
https://travellermap.com/doc/API#poster-render-a-sector-quadrant-or-subsector
"file" is the sector data in one of the valid text formats.
"metadata" is the sector metadata in (in my case) XML format.
Line endings everywhere are CRLF.
I discovered that the "filename" fields, although not used, are required. The Content-Type declaration for each part is also required.
This particular example requests a subsector map, and returns an image (png, I believe).
However you generate this, something like this is what you want to send to the Poster API. Your headers will vary. See the docs at:
https://travellermap.com/doc/API#poster-render-a-sector-quadrant-or-subsector
"file" is the sector data in one of the valid text formats.
"metadata" is the sector metadata in (in my case) XML format.
Line endings everywhere are CRLF.
I discovered that the "filename" fields, although not used, are required. The Content-Type declaration for each part is also required.
Code:
POST /api/poster?subsector=A&scale=72&style=poster&options=25595&sscords=1 HTTP/1.1
Host: travellermap.com
Content-Type: multipart/form-data; boundary= IMTUStrephonLives
Connection: keep-alive
Accept: */*
User-Agent: SectorMaker.debug/1.0.0 CFNetwork/901.1 Darwin/17.7.0
Accept-Language: en-us
Accept-Encoding: br, gzip, deflate
Content-Length: 2288
--IMTUStrephonLives
Content-Disposition: form-data; name="file"; filename="sectordata.txt"
Content-Type: text/plain
contents of sectordata.text
--IMTUStrephonLives
Content-Disposition: form-data; name="metadata"; filename="sectormetadata.txt"
Content-Type: text/plain
contents of sectormetadata.text
--IMTUStrephonLives--