Tripletex API v2

Content might be outdated

Uses Swagger 2.0, but is not using operationId as a uniq identifier. Generating client code with go-swagger fails because of this. Solution: Delete every instance of operationId from the swagger file.

 

Token

Be sure to set experationDate to a date in the future, or your token will not be valid.

Context expired Set context time out, or else it looks like it defaults to 0. params.SetTimeout(time.Second * 10)

Example client

 1package main
 2
 3import (
 4	"fmt"
 5	"log"
 6	"time"
 7
 8	apiclient "github.com/catoaune/tripletex/client"
 9	"github.com/catoaune/tripletex/client/orderline"
10	httptransport "github.com/go-openapi/runtime/client"
11	"github.com/go-openapi/strfmt"
12)
13
14func main() {
15
16	// create the API client
17	schemes := []string{"https"}
18	client := apiclient.New(httptransport.New("api.tripletex.io", "v2", schemes), strfmt.Default)
19
20	basicAuth := httptransport.BasicAuth("0", "19efec55-f158-458b-9562-731883e0bab3")
21	
22    params := &orderline.GetOrderOrderlineIDParams{}
23	params.SetID(380612)
24	params.SetTimeout(time.Second * 10)
25	resp, err := client.Orderline.GetOrderOrderlineID(params, basicAuth)
26	
27    if err != nil {
28		log.Fatal(err)
29	}
30	fmt.Printf("%#v\n", resp.Payload)
31}

To send something (POST)

1// create the API client
2	schemes := []string{"https"}
3	transprt := httptransport.New("api.tripletex.io", "v2", schemes)
4	transprt.Producers["application/json; charset=utf-8"] = runtime.JSONProducer()
5	client := apiclient.New(transprt, strfmt.Default)

Add an orderline Requires this as a minimum

 1	product := &models.Product{ID: 21477466}
 2	orderdate := "2019-02-13"
 3	deliverydae := "2019-03-01"
 4	cname := "Kunde 2"
 5	c := &models.Customer{ID: 11004739, Name: &cname}
 6	order := &models.Order{ID: 1260164, OrderDate: &orderdate, DeliveryDate: &deliverydae, Customer: c}
 7	orderl := &models.OrderLine{Count: 20, UnitCostCurrency: 200.00, UnitPriceExcludingVatCurrency: 1000.00, Product: product, Order: order}
 8	params2 := &orderline.PostOrderOrderlineParams{}
 9	params2.SetBody(orderl)
10	params2.SetTimeout(time.Second * 10)
11
12	resp2, err2 := client.Orderline.PostOrderOrderline(params2, basicAuth)