Skip to content

Commit 39b1263

Browse files
committed
Updated notes API with posing the data in json formate
1 parent 591d1c3 commit 39b1263

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

GoInfoGame/GoInfoGame/Network/APIEndPoint.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@ struct APIEndpoint {
127127
let header = [
128128
"Authorization": "Bearer \(accessToken)",
129129
"X-Workspace": workspaceId,
130-
"Content-Type": "application/xml"
130+
"Content-Type": "application/json"
131+
]
132+
let body = [
133+
"lat" : lat,
134+
"lon" : long,
135+
"text" : note
131136
]
132-
return APIEndpoint(path: "/notes?lat=\(lat)&lon=\(long)&text=\(note)", method: "POST", body: nil, headers: header, formData: nil)
137+
let jsonData = try? JSONSerialization.data(withJSONObject: body, options: [])
138+
return APIEndpoint(path: "/notes.json", method: "POST", body: jsonData, headers: header, formData: nil)
133139

134140
}
135141
}

0 commit comments

Comments
 (0)