API Uploading

API Uploading is a simple, flexible way to submit files for processing. Currently, these options are a bit limited, and we’ll simply return you to our site

Uploading via hosted URLs

Files hosted online can be turned into upload links by prefixing them with https://oshpark.com/import?url=.

This is great for creating easy, up to date links on site like Github, blogs, or any other file hosting service of your choice.

https://oshpark.com/import?url=http://example.com/pcb-files.zip

These import links will take you to our upload page and immediately begin processing the file.

Ordering via file upload request

We support POST file uploads, allowing for boards to be uploaded from many local applications without a remote hosting service.

These requests will generate a url which you can visit to access the file that’s processing.

Currently, it’s not possible to use the api upload to recieve previews, warnings, or add the project to your account. We look forward to this capability in the future though.

Using Eagle

We have a brand new Eagle tool that adds an upload button! You can find more information about this at our Eagle Tools project page!

Using CuRL

On Mac and Linux systems, you should be able to use the curl command line utility with little or no configuration. It can also be installed on Windows.

Plain text

curl -F file=@/path/to/file.zip https://oshpark.com/import

which will create a response in the form of https://oshpark.com/uploads/orderid

This will return a simple URL that you can copy into your browser, or pipe into another tool to automatically open it for you.

JSON format

Simply append .json to the import url.

curl -F file=@/path/to/file.zip https://oshpark.com/import.json

which will print a response in the form of {"token":"orderid","url":"https://oshpark.com/uploads/orderid"}

Using Custom Apps

Almost all programming languages can create a POST file form web request.

The request must have a Content-Type of multipart/form-data. This most likely will be configured automatically when using a file upload tool.

The file contents must be uploaded in a form data field under the file parameter. The content type for the file contents should be handled automatically.

If your apppication or framework doesn’t “just work”, try using the netcat (or nc) utility to see what’s being sent. On unix systems, you can use this command to create a listener.

nc -l localhost -p 8080

Then simply send a request to localhost:8080, and netcat will print the data your application is sending. This example shows a header sent by curl, which is a helpful known-good reference.

POST / HTTP/1.1
Host: localhost:8080
User-Agent: curl/7.50.1
Accept: */*
Content-Length: 11848
Expect: 100-continue
Content-Type: multipart/form-data; boundary=SOMEUNIQUESTRING

--SOMEUNIQUESTRING
Content-Disposition: form-data; name="file"; filename="example.brd"
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
... file contents removed ...
</eagle>

--SOMEUNIQUESTRING--